I am trying to use the copyField directive in Solr to copy some fields into a catch-all field for searching. Unfortunately the field does not seem to be populated via the copyField directives at all.
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:
<!-- 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.
Do I need to do anything else to get copyField working? I am running Solr v5.2.1.
Here is the textSuggest field type used for the catch-all field:
<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:
<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.
In your filters, use copyField
instead of copyfield
(with capital F).
Source : Documentation of Solr