hassan arafat
hassan arafat

Reputation: 667

Solr Error when adding documents

I've created a solr core called "fuzzy", however i'm unable to add documents to the core, I've tried adding the document using the following URL:

http://localhost:8983/solr/Fuzzy/update?stream.body=<add><doc><field%20name="id">1</field><field%20name="original">München</field><field%20name="mutation">Munchen</field></doc></add>&commit=true

but i keep getting the messageL

unknown UpdateRequestProcessorChain: add-unknown-fields-to-the-schema

I'm not sure why i'm getting this message, In my config file I have :

<schemaFactory class="ClassicIndexSchemaFactory"/>

and schema.xml :

<?xml version="1.0" encoding="UTF-8" ?>
<schema name="WikiData" version="1.5">
    <field name="id" type="int" indexed="true" stored="true" required="true" multiValued="false" />
    <field name="original" type="text_general" indexed="true" stored="true" />
    <field name="mutation" type="text_general" indexed="true" stored="true" />
    <field name="_version_" type="long" indexed="true" stored="true"/>
    <uniqueKey>id</uniqueKey>

    <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
    <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" multiValued="false">
      <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.PorterStemFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.PorterStemFilterFactory"/>
      </analyzer>
    </fieldType>
</schema>

solrconfig.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<config>
  <luceneMatchVersion>5.3.1</luceneMatchVersion>
  <lib dir="${solr.install.dir:../../../..}/contrib/extraction/lib" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-cell-\d.*\.jar" />

  <lib dir="${solr.install.dir:../../../..}/contrib/clustering/lib/" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-clustering-\d.*\.jar" />

  <lib dir="${solr.install.dir:../../../..}/contrib/langid/lib/" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-langid-\d.*\.jar" />

  <lib dir="${solr.install.dir:../../../..}/contrib/velocity/lib" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-velocity-\d.*\.jar" />
  <dataDir>${solr.data.dir:}</dataDir>
  <directoryFactory name="DirectoryFactory"
                    class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}"/>
  <codecFactory class="solr.SchemaCodecFactory"/>

  <schemaFactory class="ClassicIndexSchemaFactory"/>
  <indexConfig>
    <lockType>${solr.lock.type:native}</lockType>
  </indexConfig>
  <jmx />
  <updateHandler class="solr.DirectUpdateHandler2">
    <updateLog>
      <str name="dir">${solr.ulog.dir:}</str>
      <int name="numVersionBuckets">${solr.ulog.numVersionBuckets:65536}</int>
    </updateLog>
    <autoCommit>
      <maxTime>${solr.autoCommit.maxTime:15000}</maxTime>
      <openSearcher>false</openSearcher>
    </autoCommit>
    <autoSoftCommit>
      <maxTime>${solr.autoSoftCommit.maxTime:-1}</maxTime>
    </autoSoftCommit>
  </updateHandler>

  <query>
    <maxBooleanClauses>1024</maxBooleanClauses>
    <filterCache class="solr.FastLRUCache"
                 size="512"
                 initialSize="512"
                 autowarmCount="0"/>

    <queryResultCache class="solr.LRUCache"
                      size="512"
                      initialSize="512"
                      autowarmCount="0"/>

    <documentCache class="solr.LRUCache"
                   size="512"
                   initialSize="512"
                   autowarmCount="0"/>
    <cache name="perSegFilter"
           class="solr.search.LRUCache"
           size="10"
           initialSize="0"
           autowarmCount="10"
           regenerator="solr.NoOpRegenerator" />
    <enableLazyFieldLoading>true</enableLazyFieldLoading>

    <queryResultWindowSize>20</queryResultWindowSize>
    <queryResultMaxDocsCached>200</queryResultMaxDocsCached>
    <listener event="newSearcher" class="solr.QuerySenderListener">
      <arr name="queries">
      </arr>
    </listener>
    <listener event="firstSearcher" class="solr.QuerySenderListener">
      <arr name="queries">
      </arr>
    </listener>
    <useColdSearcher>false</useColdSearcher>
    <maxWarmingSearchers>2</maxWarmingSearchers>

  </query>
  <requestDispatcher handleSelect="false" >
    <requestParsers enableRemoteStreaming="true"
                    multipartUploadLimitInKB="2048000"
                    formdataUploadLimitInKB="2048"
                    addHttpRequestToContext="false"/>
    <httpCaching never304="true" />
  </requestDispatcher>
  <requestHandler name="/select" class="solr.SearchHandler">

  <admin>
    <defaultQuery>*:*</defaultQuery>
  </admin>

</config>

Upvotes: 2

Views: 2153

Answers (1)

Davids Stack
Davids Stack

Reputation: 78

The default managed-schema which the documentation suggests should be copied to schema.xml includes an update processor request chain that is not required when not using a managed schema. (Or at least this is true in 6.1.0)

The following lines should be removed or commented out from solrconfig.xml:

<initParams path="/update/**">
  <lst name="defaults">
    <str name="update.chain">add-unknown-fields-to-the-schema</str> 
  </lst>
</initParams>

An alternative might be to continue to use the managed-schema instead of the classic approach, but set it to be un-mutable although I haven't tested this e.g.

<schemaFactory class="ManagedIndexSchemaFactory">
   <bool name="mutable">false</bool>
   <str name="managedSchemaResourceName">managed-schema</str>
</schemaFactory>

Upvotes: 5

Related Questions