3

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.

EDIT

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.

PizzaTheHut
  • 637
  • 2
  • 6
  • 20
  • please share the details of "textSuggest". like analyser and filters used – Abhijit Bashetti Jul 10 '15 at 11:25
  • there is no need of using the type="text_general" for the source field and no need to mark them as indexed = true if you are not going to search on them directly. instead mark those fields as type String – Abhijit Bashetti Jul 10 '15 at 11:27
  • whats the text been indexed and whats the text you are searching for ? – Abhijit Bashetti Jul 10 '15 at 12:10
  • text being indexed is firstName and lastName fields, and these should be copied into the name_Search field. It is the name_Search field I am searching on with the suggest handler. – PizzaTheHut Jul 10 '15 at 12:19
  • yes i got that ... give me sample name to index and whats text are you querying example indexing the name "Abhijit Bashetti" and search is like ijit and you expect it to work ...something like that – Abhijit Bashetti Jul 10 '15 at 12:25
  • Ok, firstName would index "George", and I expect "Geo" to return a hit. This works when querying firstName with suggest, and when I explicity add "George" to the name_Search field, just not through copyField. – PizzaTheHut Jul 10 '15 at 12:52

1 Answers1

6

In your filters, use copyField instead of copyfield (with capital F).

Source : Documentation of Solr

alexf
  • 1,303
  • 9
  • 20