由于模式导致的Solr异常

时间:2013-11-18 18:33:56

标签: solr solr-schema

我有以下solr架构

<?xml version="1.0" encoding="UTF-8" ?>
<schema name="testthing" version="1.5">
    <fields>
        <field name="_version_"     type="long"     indexed="true"  stored="true"   required="true"/>
        <field name="doc_id"        type="string"   indexed="true"  stored="true"   required="true"     multiValued="false"/>
        <field name="title"         type="string"   indexed="true"  stored="true"   required="false"    multiValued="false"/>
        <field name="doc_type"      type="string"   indexed="false" stored="true"   required="true"     multiValued="false"/>
        <field name="description"   type="string"   indexed="true"  stored="true"   required="false"    multiValued="false"/>
        <field name="allText"       type="fs_text"  indexed="true"  stored="false"  required="true"     multiValued="true"/>
    </fields>

    <uniqueKey>doc_id</uniqueKey>

    <copyField source="title" dest="allText" />
    <copyField source="description" dest="allText" />
    <dynamicField name="*" type="ignored" multiValued="true" />

    <types>
        <fieldType name="string" class="solr.StrField" sortMissingLast="true" />
        <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
        <fieldType name="fs_text" class="solr.TextField" positionIncrementGap="100"/>
    </types>
</schema>

Solr抱怨在动态字段类型

中缺少字段文本
1898 [main] INFO  org.apache.solr.servlet.SolrDispatchFilter  ? SolrDispatchFilter.init() done
1918 [searcherExecutor-4-thread-1] ERROR org.apache.solr.core.SolrCore  ? org.apache.solr.common.SolrException: undefined field text at org.apache.solr.schema.IndexSchema.getDynamicFieldType(IndexSchema.java:1235)

但是,我唯一的动态字段(忽略所有不匹配的字段)不使用文本类型(它的类型=忽略)。

我在这里缺少什么?

**到目前为止,将allText重命名为文本几乎解决了问题,但我无法弄清楚原因! Solr 4.1中是否有关于文本的特殊/预定义内容?

1 个答案:

答案 0 :(得分:2)

不是关于字段类型“文本”。它是关于名为“text”的字段。

<defaultSearchField>text</defaultSearchField>

您可能更改或删除了配置中的默认字段。如果这样可以解决问题,那么您知道配置中的某个位置是指“text”字段,可能是在

中建议的solrconfig.xml中