O'Reilly logo

Instant Apache Solr for Indexing Data How-to by Alexandre Rafalovitch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Solr's XML format (Simple)

While CSV is perfectly an useful import format for Solr, it starts to get unwieldy very quickly. Fortunately, Solr supports a number of import formats. One of them is Solr's own update XML import format. It is more verbose than CSV, but you will see that it is easier to read and deals better with multivalued fields, optional fields, complex text strings, and other real-life requirements.

How to do it...

  1. Copy and rename the multivalued directory to a directory named xml and delete the data subdirectory in the new copy.
  2. Add another collection/core reference to solr.xml in the SOLR-INDEXING directory:
    <core name="xml" instanceDir="xml" />
  3. In schema.xml (under the xml/conf directory):

    a. Inside the fields section, add three ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required