Ric*_*yer 7 xml configuration schema solr
我试图让Solr核心与我自己一起运行schema.xml
,但是Solr(版本5.2.1)一直在抱怨缺少的fieldType
元素甚至不在我的fields
定义中.
org.apache.solr.common.SolrException: fieldType 'booleans' not found in the schema
Run Code Online (Sandbox Code Playgroud)
每当我添加一个'missing'时,会fieldtype
弹出另一个错误,抱怨另一个fieldType
丢失,比如longs
等等,直到我将它们全部添加并且接受了架构而没有错误.
现在为什么fieldtype
在没有用的时候我必须提供这些元素?
在config.xml
我有:
<schemaFactory class="ClassicIndexSchemaFactory"/>
Run Code Online (Sandbox Code Playgroud)
这是我的schema.xml
:
<schema name="collections" version="1.5">
<fields>
<field name="id_object" type="string" indexed="true" stored="true" />
<field name="id_organization" type="string" indexed="true" stored="true" />
<field name="title" type="string" indexed="true" stored="true" />
<field name="artist" type="string" indexed="true" stored="true" />
<field name="searchname" type="string" indexed="true" stored="true" />
<field name="technique_group" type="string" indexed="true" stored="true" />
<field name="technique" type="string" indexed="true" stored="true" />
<field name="color_type" type="string" indexed="true" stored="true" />
<field name="color" type="string" indexed="true" stored="true" />
<field name="subject" type="string" indexed="true" stored="true" />
<field name="height" type="tint" indexed="true" stored="true" />
<field name="width" type="tint" indexed="true" stored="true" />
<field name="depth" type="tint" indexed="true" stored="true" />
<field name="price_sale" type="tfloat" indexed="true" stored="true" />
<field name="price_rental" type="tfloat" indexed="true" stored="true" />
<field name="price_rental_with_savings" type="tfloat" indexed="true" stored="true" />
<field name="savings_portion" type="tfloat" indexed="true" stored="true" />
<field name="year" type="tint" indexed="true" stored="true" />
<field name="is_for_rent" type="boolean" indexed="true" stored="true" />
<field name="is_for_sale" type="boolean" indexed="true" stored="true" />
<field name="status" type="string" indexed="true" stored="true" />
<field name="shipment" type="tfloat" indexed="true" stored="true" />
<field name="timestamp" type="tdate" indexed="true" stored="true" default="NOW" />
<!-- catch all field, must be multiValued if any of its source fields is -->
<field name="quick_search" type="text" indexed="true" stored="false" />
<!-- mandatory -->
<field name="_version_" type="tlong" indexed="true" stored="true" />
</fields>
<uniqueKey>id_object</uniqueKey>
<copyField source="id_object" dest="quick_search" />
<copyField source="title" dest="quick_search" />
<copyField source="artist" dest="quick_search" />
<copyField source="searchname" dest="quick_search" />
<copyField source="technique_group" dest="quick_search" />
<copyField source="technique" dest="quick_search" />
<copyField source="color_type" dest="quick_search" />
<copyField source="color" dest="quick_search" />
<copyField source="subject" dest="quick_search" />
<types>
<fieldtype name="string" class="solr.StrField" />
<fieldtype name="boolean" class="solr.BoolField" />
<fieldtype name="tint" class="solr.TrieIntField" />
<fieldtype name="tlong" class="solr.TrieLongField" />
<fieldtype name="tfloat" class="solr.TrieFloatField" />
<fieldtype name="tdate" class="solr.TrieDateField" />
<fieldtype name="text" class="solr.TextField"/>
</types>
</schema>
Run Code Online (Sandbox Code Playgroud)
那里没有一个multiValued
字段.尽管如此,我尝试multiValued='false'
单独为每个字段明确设置,但无济于事.即使我将整个架构剥离到少数几个String
字段,它仍会产生该错误.
我很自信我schema.xml
的确可以,但也许某些地方应该告诉Solr放轻松.
不确定它是否是首选的方式,但注释掉该solr.AddSchemaFieldsUpdateProcessorFactory
部分config.xml
似乎解决了这个问题.
<!--
<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>
-->
Run Code Online (Sandbox Code Playgroud)
<lst name="typeMapping">
<str name="valueClass">java.lang.Boolean</str>
<str name="fieldType">booleans</str>
</lst>
Run Code Online (Sandbox Code Playgroud)
在这里,您需要将“布尔值”更正为“布尔值”。
<lst name="typeMapping">
<str name="valueClass">java.lang.Boolean</str>
<str name="fieldType">boolean</str>
</lst>
Run Code Online (Sandbox Code Playgroud)
然后它会工作..
或者
替代的解决方案是注释掉<updateRequestProcessorChain name="add-unknown-fields-to-the-schema">
节solrconfig.xml
。