我试图在Solr中使用copyField指令将一些字段复制到一个catch-all字段进行搜索。不幸的是,该字段似乎根本没有通过copyField指令填充。
以下是我的源字段:
<field name="firstName" type="text_general" indexed="true" stored="true" required="false" />
<field name="lastName" type="text_general" indexed="true" stored="true" required="false" />
<field name="postCode" type="text_general" indexed="true" stored="true" required="false" />
<field name="emailAddress" type="text_general" indexed="true" stored="true" required="false" />
<!-- suggest field -->
<field name="name_Search" type="textSuggest" indexed="true" stored="true" multiValued="true" />
这是我的copyField指令:
<!-- copy fields -->
<copyfield source="firstName" dest="name_Search" />
<copyfield source="lastName" dest="name_Search" />
<copyfield source="emailAddress" dest="name_Search" />
<copyfield source="postCode" dest="name_Search" />
现在在“name_Search”字段上运行查询不会产生任何结果,并且该字段不会出现在架构浏览器中。
我是否需要做其他事情才能让copyField正常工作?我正在运行Solr v5.2.1。
以下是用于catch-all字段的textSuggest字段类型:
<fieldType class="solr.TextField" name="textSuggest" positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
在SolrConfig.xml中,已按如下方式配置了建议处理程序:
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">default</str>
<str name="lookupImpl">FuzzyLookupFactory</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">name_Search</str>
<str name="suggestAnalyzerFieldType">textSuggest</str>
<str name="buildOnStartup">true</str>
<str name="buildOnCommit">true</str>
</lst>
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy" >
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">10</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>
</requestHandler>
我知道建议处理程序有效,就像我明确填写'name_Search'字段一样,然后我可以按预期得到结果。