dinsdag 5 juli 2016

SOLR using schema.xml

When you do not want to use the dynamicfields and the managed-schema in SOLR:

> in the conf/solrconfig.xml of your core directory, add to the <config> node:

<config>...
    <schemaFactory class="ClassicIndexSchemaFactory"/>

> in the conf/solrconfig.xml of your core directory, remove the
<processor class="solr.AddSchemaFieldsUpdateProcessorFactory"> from the
<updateRequestProcessorChain
The processor that must be removed from the chain looks like:
    <processor class="solr.AddSchemaFieldsUpdateProcessorFactory">
      <str name="defaultFieldType">strings</str>
      <lst name="typeMapping">
        <str name="valueClass">java.lang.Boolean</str>
        <str name="fieldType">booleans</str>
      </lst>
      <lst name="typeMapping">
        <str name="valueClass">java.util.Date</str>
        <str name="fieldType">tdates</str>
      </lst>
      <lst name="typeMapping">
        <str name="valueClass">java.lang.Long</str>
        <str name="valueClass">java.lang.Integer</str>
        <str name="fieldType">tlongs</str>
      </lst>
      <lst name="typeMapping">
        <str name="valueClass">java.lang.Number</str>
        <str name="fieldType">tdoubles</str>
      </lst>
    </processor>

> in the conf directory of your core, add the file schema.xml:

<?xml version="1.0" encoding="UTF-8" ?>

<schema name="example-schema-xml" version="1.6">
    <fieldType name="long" class="solr.TrieLongField" docValues="true" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="string" class="solr.StrField" sortMissingLast="true" docValues="true" /> 
 
    <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
 <!-- onderstaande twee velden schijnen nodig te zijn voor resp. transactie en block-join support -->
    <field name="_version_" type="long" indexed="true" stored="false"/>
    <field name="_root_" type="string" indexed="true" stored="false" docValues="false" />
 
    <field name="complete_l" type="long" indexed="false" stored="true"/>
    <field name="tekst_txt" type="string" indexed="true" stored="false"/>
 
    <uniqueKey>id</uniqueKey>
</schema>

> remove the managed-schema in the conf directory.

Geen opmerkingen:

Een reactie posten