简体   繁体   English

Solr中的CopyField似乎无法工作

[英]CopyField in Solr Doesnt Seem to Work

I am trying to use the copyField directive in Solr to copy some fields into a catch-all field for searching. 我试图在Solr中使用copyField指令将一些字段复制到一个catch-all字段进行搜索。 Unfortunately the field does not seem to be populated via the copyField directives at all. 遗憾的是,该字段似乎根本没有通过copyField指令填充。

Here are my source fields: 这是我的源字段:

    <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" />

And here are my copyField directives: 这是我的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" />

Now running a query on the "name_Search" field does not yield any results, and the field does not appear in the schema browser. 现在,在“name_Search”字段上运行查询不会产生任何结果,并且该字段不会出现在架构浏览器中。

Do I need to do anything else to get copyField working? 我需要做任何其他事情才能让copyField工作吗? I am running Solr v5.2.1. 我正在运行Solr v5.2.1。

EDIT 编辑

Here is the textSuggest field type used for the catch-all field: 以下是用于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>

In the SolrConfig.xml, have configured the suggest handler as follows: 在SolrConfig.xml中,已按如下方式配置了suggest处理程序:

  <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>

I know the suggest handler works, as if I explicitly fill the 'name_Search' field, then I can get results as expected. 我知道建议处理程序有效,就好像我明确填写'name_Search'字段,然后我可以按预期获得结果。

In your filters, use copyField instead of copyfield (with capital F). 在过滤器中,使用copyField而不是copyfield (使用大写copyfield F)。

Source : Documentation of Solr 来源: Solr的文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM