`

Nutch2 + Solr 6: This IndexSchema is not mutable

 
阅读更多

 

2017-06-23 14:04:33,435 WARN  mapred.LocalJobRunner - job_local860080165_0001

java.lang.Exception: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: This IndexSchema is not mutable.

at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462)

at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522)

Caused by: org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: This IndexSchema is not mutable.

at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:491)

at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:197)

at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:117)

 

解决方法:

reference:https://stackoverflow.com/questions/31719955/solr-error-this-indexschema-is-not-mutable

solrconfig.xml文件中将AddSchemaFieldsUpdateProcessorFactory部分从节点updateRequestProcessorChain中注释掉。

 

知其然和所以然:

下面是solrconfig.xml文件中对updateRequestProcessorChain的解释:

  <!-- Add unknown fields to the schema 
  
       An example field type guessing update processor that will
       attempt to parse string-typed field values as Booleans, Longs,
       Doubles, or Dates, and then add schema fields with the guessed
       field types.  
       
       This requires that the schema is both managed and mutable, by
       declaring schemaFactory as ManagedIndexSchemaFactory, with
       mutable specified as true. 
       
       See http://wiki.apache.org/solr/GuessingFieldTypes
    -->
     <updateRequestProcessorChain name="add-unknown-fields-to-the-schema">
          ...
     </updateRequestProcessorChain>

schemaFactory在上文中提到了,它可以指定两个值:

    1)ClassicIndexSchemaFactory(默认值):需要使用schema.xml文件,并且只能通过手动修改这个问题;只在collection加载的时候加载。不允许Schema API来修改schema。

    2)ManagedIndexSchemaFactory:可以通过Schema API来修改schema,不会再读schema.xml文件,而是取managedSchemaResourceName中定义的资源

 

    我的solrconfig.xml中并未指定schemaFactory的值,即使用了ClassicIndexSchemaFactory,执行中不准许修改schema。

 

AddSchemaFieldsUpdateProcessorFactory:如果输入的document包含了不匹配schema的feilds,这些fields会动态的添加到schema中,可见它是用于ManagedIndexSchemaFactory的配置。不属于我们这种情况。

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics