Create a custom schema 

Advanced DSE Search tutorial steps to replace the basic tutorial Solr schema with a custom schema.

These advanced DSE Search tutorial steps replace the basic tutorial Solr schema with a custom schema. The tutorial files that you downloaded in the basic tutorial include a Solr schema and a solrconfig file.

Procedure

Follow these steps to replace the schema with a custom schema that corresponds to the hits table and defines a dynamic field:

  1. Open the schema.xml in the solr_tutorial46 directory.
  2. Compare the schema with the corresponding hits table that you created.
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <schema name="topHits" version="1.5">
      <types>
        <fieldType class="org.apache.solr.schema.TextField" name="TextField">
          <analyzer>
            <tokenizer class="solr.StandardTokenizerFactory"/>
          </analyzer>
        </fieldType>
        <fieldType class="org.apache.solr.schema.UUIDField" name="UUIDField"/>
      </types>
    <fields>
      <dynamicField indexed="true" multiValued="false" name="lang_*" stored="true" type="TextField"/>
      <field indexed="true" multiValued="false" name="song" stored="true" type="UUIDField"/>
    </fields>
    <uniqueKey>song</uniqueKey>
    </schema>

    The uniqueKey is the name of the CQL primary key. The dynamicField is the name of the CQL lang_ column plus the asterisk wildcard suffix. A tokenizer determines the parsing of the example text. The fields specify the data that Solr indexes and stores. You will be able to query on data using lang_*, as shown later in this tutorial.