Solr Spellchecker Component (Suggester) for phrase across multiple field (with different tokenizers)

603 Views Asked by At

I am trying to implement auto-suggest feature with solr using multiple fields which needs to support different tokenizers. The scenario i want to accomplish is as below:

There are two field author(KeywordTokenizer) & subject(StandardTokenizer) which are copied to autosuggest(used as spellcheck.field)

<field name="author" type="phrase" indexed="true" stored="true" multiValued="false"/>
<field name="subject" type="text_general" indexed="true" stored="true"/> 
<field name="autosuggest" type="text_general" indexed="true" stored="true"     multiValued="true"/>
<copyField source="*" dest="autosuggest"/>
<fieldType name="phrase" class="solr.TextField" positionIncrementGap="100">
  <analyzer>
     <tokenizer class="solr.KeywordTokenizerFactory" />
     <filter class="solr.LowerCaseFilterFactory" />
     <filter class="solr.RemoveDuplicatesTokenFilterFactory" />         
   </analyzer>
</fieldType>

Sample values: Subject - "Dell boost Widescreen UltraSharp 3007WFP" ; Author - "Del Stiller"

Search Query : solr/select?q=de ; Expected Result : dell, del stiller

The result are varying based on the fieldtype assigned autosuggest.However what i need is to copy tokens from each field to "autosuggest" instead of copying values and later the tokenizer creating new tokens on the collated field values.

I'm using SOLR 4.5.1

1

There are 1 best solutions below

0
On

what happens here is that stored=true stored the original value in the target field too.

For your simple use case, using TermsComponent might be enough, look at how to do it here, where it says 'Use in Auto-Complete'. This would work as the terms are returned by this component, not the stored values.