2

I migrated the project from Sitecore 8.2 to Sitecore 9.1.1.

There was a suggester component that we were using to provide a suggestion for a search term. As part of the migration, I also created a new instance of Solr7.2.1 as per the compatibility matrix of Sitecore 9.1.1.

I copied the exact same configuration from Solr 5.1 to Sitecore7.2.1. I removed one configuration as suggested in the post:

Sitecore 9.1.1 Solr suggester not returning any data

The issue that I have at the moment is results are not matching:

In Solr5.1 return JSON was

{"responseHeader":{"status":0,"QTime":2},"suggest":{"fuzzySuggester":{"water":{"numFound":10,"suggestions":[{"term":"Water checklist","weight":0,"payload":""},{"term":"Water efficiency","weight":0,"payload":""},{"term":"Water efficiency tips","weight":0,"payload":""},{"term":"Water efficient devices","weight":0,"payload":""},{"term":"Water Netserv Plan","weight":0,"payload":""},{"term":"Water pressure issues","weight":0,"payload":""},{"term":"Water quality","weight":0,"payload":""},{"term":"Water quality issues","weight":0,"payload":""},{"term":"Water quality results","weight":0,"payload":""},{"term":"Water quality testing and reports","weight":0,"payload":""}]}},"infixSuggester":{"water":{"numFound":10,"suggestions":[{"term":"<b>Water</b> Netserv Plan","weight":0,"payload":""},{"term":"<b>Water</b> Netserv Plan","weight":0,"payload":""},{"term":"<b>Water</b> Netserv Plan","weight":0,"payload":""},{"term":"<b>Water</b> quality","weight":0,"payload":""},{"term":"<b>Water</b> quality","weight":0,"payload":""},{"term":"<b>Water</b> quality","weight":0,"payload":""},{"term":"<b>Water</b> quality","weight":0,"payload":""},{"term":"<b>Water</b> quality","weight":0,"payload":""},{"term":"<b>Water</b> quality","weight":0,"payload":""},{"term":"<b>Water</b> quality","weight":0,"payload":""}]}}}}

Return JSON in Solr7.2.1:

{
  "responseHeader":{
    "status":0,
    "QTime":4},
  "suggest":{
    "fuzzySuggester":{
      "water":{
        "numFound":1,
        "suggestions":[{
            "term":"water",
            "weight":348,
            "payload":""}]}},
    "infixSuggester":{
      "water":{
        "numFound":1,
        "suggestions":[{
            "term":"<b>water</b>",
            "weight":348,
            "payload":""}]}}}}

As you can see that the search results in 5.1 has more terms and is returning the multiple words in the terms which match the title of pages in Sitecore. Whereas in Solr7.2.1 it is not returning any terms with more than one word.

My current Solr configuration: Solrconfig.xml

 <searchComponent name="suggest" class="solr.SuggestComponent">
    <lst name="suggester">
        <str name="name">fuzzySuggester</str>
        <str name="lookupImpl">FuzzyLookupFactory</str>
        <str name="storeDir">fuzzy_suggestions</str>
        <str name="dictionaryImpl">DocumentDictionaryFactory</str>
        <str name="field">_content</str>
        <str name="weightField">weight</str>
        <str name="suggestAnalyzerFieldType">suggestType</str>
        <str name="buildOnStartup">false</str>
        <str name="buildOnCommit">false</str>
    </lst>
    <lst name="suggester">
        <str name="name">infixSuggester</str>
        <str name="lookupImpl">AnalyzingInfixLookupFactory</str>
        <str name="indexPath">infix_suggestions</str>
        <str name="dictionaryImpl">DocumentDictionaryFactory</str>
        <str name="field">_content</str>
        <!--<str name="weightField">weight</str>-->
        <str name="suggestAnalyzerFieldType">suggestType</str>
        <str name="buildOnStartup">false</str>
        <str name="buildOnCommit">false</str>
    </lst>
  </searchComponent>

<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy" >
      <lst name="defaults">
          <str name="suggest">true</str>
          <str name="suggest.dictionary">infixSuggester</str>
          <str name="suggest.dictionary">fuzzySuggester</str>
          <str name="suggest.onlyMorePopular">true</str>
          <str name="suggest.count">10</str>
          <str name="suggest.collate">true</str>
      </lst>
      <arr name="components">
          <str>suggest</str>
      </arr>
  </requestHandler>

My Managed schema:

<fieldtype name="suggestType" class="solr.TextField" positionIncrementGap="100">
     <analyzer>
            <charFilter class="solr.PatternReplaceCharFilterFactory" pattern="[^a-zA-Z0-9]" replacement=" " />
            <tokenizer class="solr.WhitespaceTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
        </analyzer>
    </fieldtype>
3

1 Answer 1

3
+50

I think that something is wrong with your custom fieldtype suggestType, .

Did you try to change it with something else (for example with text_general)?

I am not sure that charFilter solr.PatternReplaceCharFilterFactory works in solr 7. (And as I see it doesn`t replace in tags < and > ).

From my practice (solr 6-7) suggester works only with AnalyzingInfixLookupFactory (or without any lookupImpl):

<lst name="suggester">
      <str name="name">mySuggesterContent</str>
      <str name="field">pagebody_t</str>
      <str name="suggestAnalyzerFieldType">text_suggester</str>
      <str name="queryAnalyzerFieldType">text_suggester</str>
      <str name="buildOnStartup">true</str>
      <str name="buildOnCommit">true</str>
    </lst>
<fieldType name="text_suggester" class="solr.TextField" positionIncrementGap="100" multiValued="false"> 
    <analyzer type="index"> 
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/> 
        <filter class="solr.LowerCaseFilterFactory"/> 
    </analyzer> 
    <analyzer type="query"> 
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/> 
        <filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/> 
        <filter class="solr.LowerCaseFilterFactory"/> 
    </analyzer> 
</fieldType> 

Also check whether your field that you use for suggester has stored="true" in managed schema. Otherwise you will not see results by querying /suggest in Solr UI.

7
  • I have tried the above configuration still getting back: { "responseHeader":{ "status":0, "QTime":6}, "suggest":{ "fuzzySuggester":{ "residential":{ "numFound":1, "suggestions":[{ "term":"residential", "weight":8, "payload":""}]}}, "infixSuggester":{ "residential":{ "numFound":1, "suggestions":[{ "term":"<b>residential</b>", "weight":8, "payload":""}]}}}} No multiple words
    – Arun Kumar
    Commented Jun 10, 2019 at 1:33
  • Yeah... solr is frequent headache. It is hard to find what is wrong in configs. Could you send me your zipped core with suggester at [email protected] ? I`ll try to help you.
    – x3mxray
    Commented Jun 10, 2019 at 8:23
  • I have emailed you the configuration from my solr index.
    – Arun Kumar
    Commented Jun 12, 2019 at 4:55
  • I found issue and send you email with explanation and screenshots. The reason was that your field "_content" that you use for suggester has stored="false" in managed schema and queries in solr ui did not find values. I hope my email will be helpful for you.
    – x3mxray
    Commented Jun 12, 2019 at 15:56
  • Thanks mate. Really appreciate your help on this one :)
    – Arun Kumar
    Commented Jun 12, 2019 at 23:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.