Indexing documents using XML
In Solr, we can index XML messages to the update handler using the content-type
tag: for example application/xml
or text/xml
. In the following subsections, we'll see how we can perform add
, update
, or delete
commands.
Adding and updating documents
Solr provides an easy-to-use XML schema; this schema can be used to index data in Solr. The XML schema mainly contains the following elements:
<add>
: This element is the parent element, and it tells Solr that we're adding a document for indexing<doc>
: This element contains all the fields that are going to be indexed<field>
: This element contains the content, name, and value of the field that is going to be indexed
For example, the sample XML document looks like the following code:
<add> <doc> <field name="songId">100000010</field> <field name="songName">(Oh No) What You Got</field> <field name="artistName">Justin...