Apache Solr - Adding Document
Let's the following data to be added to the Solr index using the XML file format.
Adding Documents Using XML
For the addition of the above data into the Solr index, we should prepare an XML document, as given below. Save the following document in a file with the name sample.xml.
As we can see, the XML file created to add data to index file contains the given three important tags named as, <add> text </add>, <doc> text </doc>, and < field > text < /field >.
After creating the document, we can add the created document to the index with the means discussed in the indexing.
Suppose the XML file exists in the Solr's bin directory and it is to be indexed in the my_core file, then we can add it to index fo Solr using the post tool as given below -
When we run the above given command, we will get the below result.
Go to the homepage of Apache Solr web UI and choose the my_core file. Try to get all the documents bypassing the query ":" inside the text area q and run the query. After executing, we can observe that the desired data is added to the Solr index.