Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-8685

Different result depending on count

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: spellchecker
    • Labels:
      None

      Description

      I got different result when spellcheck.count is less than 5. We expect to get "iaad" as the top of result, but actually got "iqad" as the result when spellcheck.count=1

      spellcheck.count=5

      <response>
      <lst name="responseHeader">
      <int name="status">0</int>
      <int name="QTime">20</int>
      </lst>
      <result name="response" numFound="0" start="0" maxScore="0.0"/>
      <lst name="spellcheck">
      <lst name="suggestions">
      <lst name="icat">
      <int name="numFound">5</int>
      <int name="startOffset">3</int>
      <int name="endOffset">7</int>
      <int name="origFreq">0</int>
      <arr name="suggestion">
      <lst>
      <str name="word">iaad</str>
      <int name="freq">1</int>
      </lst>
      <lst>
      <str name="word">ipad</str>
      <int name="freq">1</int>
      </lst>
      <lst>
      <str name="word">iqad</str>
      <int name="freq">1</int>
      </lst>
      <lst>
      <str name="word">irad</str>
      <int name="freq">1</int>
      </lst>
      <lst>
      <str name="word">isad</str>
      <int name="freq">1</int>
      </lst>
      </arr>
      </lst>
      <bool name="correctlySpelled">false</bool>
      <lst name="collation">
      <str name="collationQuery">to:iaad</str>
      <int name="hits">1</int>
      <lst name="misspellingsAndCorrections">
      <str name="icat">iaad</str>
      </lst>
      </lst>
      <lst name="collation">
      <str name="collationQuery">to:ipad</str>
      <int name="hits">1</int>
      <lst name="misspellingsAndCorrections">
      <str name="icat">ipad</str>
      </lst>
      </lst>
      <lst name="collation">
      <str name="collationQuery">to:iqad</str>
      <int name="hits">1</int>
      <lst name="misspellingsAndCorrections">
      <str name="icat">iqad</str>
      </lst>
      </lst>
      <lst name="collation">
      <str name="collationQuery">to:irad</str>
      <int name="hits">1</int>
      <lst name="misspellingsAndCorrections">
      <str name="icat">irad</str>
      </lst>
      </lst>
      <lst name="collation">
      <str name="collationQuery">to:isad</str>
      <int name="hits">1</int>
      <lst name="misspellingsAndCorrections">
      <str name="icat">isad</str>
      </lst>
      </lst>
      </lst>
      </lst>
      </response>
      

      spellcheck.count=1

      <response>
      <lst name="responseHeader">
      <int name="status">0</int>
      <int name="QTime">16</int>
      </lst>
      <result name="response" numFound="0" start="0" maxScore="0.0"/>
      <lst name="spellcheck">
      <lst name="suggestions">
      <lst name="icat">
      <int name="numFound">1</int>
      <int name="startOffset">3</int>
      <int name="endOffset">7</int>
      <int name="origFreq">0</int>
      <arr name="suggestion">
      <lst>
      <str name="word">iqad</str>
      <int name="freq">1</int>
      </lst>
      </arr>
      </lst>
      <bool name="correctlySpelled">false</bool>
      <lst name="collation">
      <str name="collationQuery">to:iaad</str>
      <int name="hits">1</int>
      <lst name="misspellingsAndCorrections">
      <str name="icat">iaad</str>
      </lst>
      </lst>
      <lst name="collation">
      <str name="collationQuery">to:ipad</str>
      <int name="hits">1</int>
      <lst name="misspellingsAndCorrections">
      <str name="icat">ipad</str>
      </lst>
      </lst>
      <lst name="collation">
      <str name="collationQuery">to:iqad</str>
      <int name="hits">1</int>
      <lst name="misspellingsAndCorrections">
      <str name="icat">iqad</str>
      </lst>
      </lst>
      <lst name="collation">
      <str name="collationQuery">to:irad</str>
      <int name="hits">1</int>
      <lst name="misspellingsAndCorrections">
      <str name="icat">irad</str>
      </lst>
      </lst>
      <lst name="collation">
      <str name="collationQuery">to:isad</str>
      <int name="hits">1</int>
      <lst name="misspellingsAndCorrections">
      <str name="icat">isad</str>
      </lst>
      </lst>
      </lst>
      </lst>
      </response>
      

      As the cause, modifyRequest method in SpellcheckComponent.java force to set 5 as spellcheck.count when spellcheck.count is less than 5. Then, mergeSuggestions method in SolrSpellChecker.java discard some results following code.

            // skip the first sugQueue.size() - count elements
            for (int k=0; k < sugQueue.size() - count; k++) sugQueue.pop();
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nobu Nobuo Onodera
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: