1

I am a newbie in Solr and I have been assigned a task to improve autosuggest
for our product.We are using Solr 6.6.0.The current requirement is when user search for Shirts , the results should display men's shirts, women's shirts as autosuggest.As of now only Shirts are shown.Please let me know in case of any leads. Below is the configuration :

<searchComponent name="suggest" class="solr.SuggestComponent">
    <lst name="suggester">
        <str name="name">flf</str>
        <str name="lookupImpl">AnalyzingLookupFactory</str>
        <str name="dictionaryImpl">DocumentDictionaryFactory</str>
        <str name="field">autosuggest</str>
        <str name="weightField">vm_score</str>
        <str name="suggestAnalyzerFieldType">textSuggest</str>
        <str name="exactMatchFirst">true</str>
        <str name="buildOnStartup">false</str>
        <str name="storeDir">autosuggest_fuzzy</str>
    </lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
    <lst name="defaults">
        <str name="suggest">true</str>
        <str name="suggest.count">5</str>
        <str name="suggest.dictionary">flf</str>
    </lst>
    <arr name="components">
        <str>suggest</str>
    </arr>
</requestHandler>

textSuggest is made from following fields in schema.xml :

<copyField source="product_name" dest="autosuggest" />
<copyField source="product_description" dest="autosuggest" />
<copyField source="brand_name" dest="autosuggest" />
<copyField source="tags" dest="autosuggest" />
<copyField source="gender" dest="autosuggest" />
<copyField source="master_category_name" dest="autosuggest" />
<copyField source="sub_category_name" dest="autosuggest" />
<copyField source="product_id" dest="autosuggest" />
<copyField source="id" dest="autosuggest" />

<field name="autosuggest" type="textSuggest" indexed="true" stored="true" 
required="false" multiValued="true" />

textSuggest field has following configuration:

<fieldType class="solr.TextField" name="textSuggest" positionIncrementGap="100">
    <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StandardFilterFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
        <filter class="solr.EdgeNGramFilterFactory" maxGramSize="100"/>
        <filter class="solr.BeiderMorseFilterFactory" nameType="GENERIC" ruleType="APPROX" concat="true" languageSet="auto" />
    </analyzer>
    <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory" />
        <filter class="solr.StandardFilterFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.BeiderMorseFilterFactory" nameType="GENERIC" ruleType="APPROX" concat="true" languageSet="auto" />
    </analyzer>
</fieldType>
Priancy
  • 219
  • 3
  • 4
  • 13
  • @javanna Can you help me in this? – Priancy Jun 07 '18 at 06:48
  • If you want to use a specific phrase like that for suggestions, you have to generate the suggestion when indexing (i.e. build custom indexes), or combine multiple suggestions. Usually the best plan is to build a custom suggestion collection and index the strings you want to use for autocompletion and what they mean (i.e. what filters to apply) to that. – MatsLindh Jun 07 '18 at 07:34
  • @MatsLindh I have to bifurcate on the basis of gender and using for is not important.It should be whenever user types any item, it should present autosuggest options for both gender.I have gender as a field.Can i add any weight to this field, so that solr outputs the required result.If its possible, where to add weights? – Priancy Jun 07 '18 at 08:16
  • I don't think the Suggester will be able to answer that - maybe facet pivots or the JSON facet API can be helpful? – MatsLindh Jun 07 '18 at 08:28
  • @MatsLindh Is there a concept like maintaining an autosuggest dictionary wherein we can store phrases for all products?If so, then how can I implement it and what params to use in the solrConfig.xml – Priancy Jun 26 '18 at 13:04
  • If you can generate the phrases, use a field designated for those phrases and then search against that field - if you use the highlighter and possibly a stopwordfilter, you can probably get the result you want. If you need to support multiple languages in a single document it might be harder, but I'd try that. – MatsLindh Jun 26 '18 at 17:41

0 Answers0