2

I have been working on Implementing Solr Auto Suggestion for my Sitecore search component.

Suggester field is title_t and contextField is _language. For my EN site, I get the right result where contextField _language is passed as suggest.cfq:en in Solr query.

But then, the actual issue is that for my Brazil site the suggest response is 0 which is NOT the expected one (In this case, the contextField _language is passed as suggest.cfq:pt-BR in Solr query).

Below is the suggester configuration details in my solrconfig.xml file:

<searchComponent name="suggest" class="solr.SuggestComponent">
    <lst name="suggester">
        <str name="name">WEMSuggester</str>
        <str name="lookupImpl">BlendedInfixLookupFactory</str>
        <str name="dictionaryImpl">DocumentDictionaryFactory</str>
        <str name="field">title_t</str>         
        <str name="contextField">_language</str>
        <str name="suggestAnalyzerFieldType">text_general</str>
        <str name="buildOnStartup">false</str>
    </lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy" >
    <lst name="defaults">
        <str name="suggest.dictionary">WEMSuggester</str>
        <str name="suggest">true</str>
        <str name="suggest.count">10</str>
    </lst>
    <arr name="components">
        <str>suggest</str>
    </arr>
</requestHandler>

Example: My search query term is "test". In CM, I have 3 items which has "test" in the title field in EN version and 2 items in pt-BR version.

Query1: When contextField is not passed in the query the result count is 5 (as expected)

https://localhost:8983/solr/product_search_master_index/suggest?
q=test&
suggest.build=true&
suggest.count=5&
fq=_indexname:(product_search_master_index)&
suggest=true

Query2: When contextField is passed as EN in the query then the result count is 3 (as expected)

https://localhost:8983/solr/product_search_master_index/suggest?
q=test&
suggest.build=true&
suggest.count=5&
fq=_indexname:(product_search_master_index)&
suggest=true&
**suggest.cfq=en**

Query3: When contextField is passed as pt-BR in the query then the result count is 0 (NOT as expected)

https://localhost:8983/solr/product_search_master_index/suggest?
q=test&
suggest.build=true&
suggest.count=5&
fq=_indexname:(product_search_master_index)&
suggest=true&
suggest.cfq=pt-BR

Is there anything that I am missing?

0 Answers0