问题描述
我正在尝试使用我自己的 schema.xml
运行 Solr 核心,但是 Solr(版本 5.2.1)一直抱怨缺少 fieldType
元素甚至在我的 fields
定义中.
I am trying to get a Solr core running with my own schema.xml
, but Solr (version 5.2.1) keeps complaining about missing fieldType
elements that aren't even in my fields
definitions.
org.apache.solr.common.SolrException: fieldType 'booleans' not found in the schema
每当我添加缺失"fieldtype
时,都会弹出另一个错误,抱怨另一个 fieldType
缺失,例如 longs
等,直到我已将它们全部添加并且架构被无误地接受.
Whenever I add a 'missing' fieldtype
another error pops up complaining about another fieldType
missing, like longs
, etc., until I've added them all and the schema is accepted without error.
现在为什么我必须提供这些没有用的 fieldtype
元素?
Now how come I must provide these fieldtype
elements when there is no use for them?
在 config.xml
我有:
<schemaFactory class="ClassicIndexSchemaFactory"/>
这是我的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>
那里没有一个 multiValued
字段.尽管如此,我尝试单独为每个字段显式设置 multiValued='false'
,但无济于事.即使我将整个架构精简为少数 String
字段,它仍然会产生该错误.
There is not a single multiValued
field in there. Nonetheless I tried explicitly setting multiValued='false'
for each field individually, but to no avail. Even when I strip the entire schema down to just a handful of String
fields it still generates that error.
我非常有信心我的 schema.xml
没问题,但也许某处的某些设置应该告诉 Solr 放轻松.
I'm pretty confident my schema.xml
is OK but perhaps some setting somewhere should tell Solr to take it easy.
推荐答案
<lst name="typeMapping">
<str name="valueClass">java.lang.Boolean</str>
<str name="fieldType">booleans</str>
</lst>
在这里您需要更正布尔值";到布尔值".
over here you need to correct "booleans" to "boolean".
<lst name="typeMapping">
<str name="valueClass">java.lang.Boolean</str>
<str name="fieldType">boolean</str>
</lst>
然后就可以了..
或
替代解决方案是注释掉 部分在
solrconfig.xml
.
The alternate solution is to comment out the <updateRequestProcessorChain name="add-unknown-fields-to-the-schema">
section in solrconfig.xml
.
这篇关于Solr 错误创建核心:在架构中找不到 fieldType [x]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!