How to add documents in solrj
Editor to share with you how to add documents in solrj, I hope you have something to gain after reading this article, let's discuss it together!
String urlString = "http://localhost:8983/solr/techproducts";SolrClient solr = new HttpSolrClient (urlString); SolrInputDocument document = new SolrInputDocument (); document.addField (" id "," 552199 "); document.addField (" name "," Gouda cheese wheel "); document.addField (" price "," 49.99 "); UpdateResponse response = solr.add (document); / / submit after adding multiple times, solr.commit ()
Note: ConcurrentUpdateSolrClient is recommended on official documents to perform update operations on a large number of documents.
After reading this article, I believe you have a certain understanding of "how to add documents in solrj". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!