You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by rashi gandhi <ga...@gmail.com> on 2019/04/05 17:22:20 UTC

Control Solr spellcheck functionality to provide suggestions for correct word

HI,

I am working on Solr spellcheck feature, and I am using index based
spellcheck dictionary as a source for spellcheck suggestions.
I observed that collated results returned by spellcheck component, provide
the suggestions for misspelled words, however also provide suggestions for
correctly spelled word in query.

For example,
 misspelled query - root priviladge to user

*collated results (even suggestion includes the same) *-
root privilege to user, room privilege to user, root privilege to users,
rest privilege to user, root privilege to used

It corrected word 'privilege' which was misspelled, however also provided
suggestions for 'root' or 'user', which were already correct.

is there a way , we can tell Solr not to provide suggestions for correct
word, when using spellcheck feature.

Please provide pointers.

Re: Control Solr spellcheck functionality to provide suggestions for correct word

Posted by Rohan Kasat <ro...@gmail.com>.
Hi Rashi,
Can you try with

<int name="minPrefix">0</int>

Also you can play with maxqueryfrequency value.

Regards,
Rohan

On Sat, Apr 6, 2019 at 2:53 AM Rashi <ga...@gmail.com> wrote:

> Hi Rohan,
>
> Sharing the configuration:
>
>  <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
>     <str name="queryAnalyzerFieldType">text_suggest</str>
>
>
>     <lst name="spellchecker">
>       <str name="name">default</str>
>       <str name="field">title</str>
>       <str name="classname">solr.DirectSolrSpellChecker</str>
>
>       <str name="distanceMeasure">internal</str>
>
>       <float name="accuracy">0.5</float>
>
>       <int name="maxEdits">2</int>
>
>       <int name="minPrefix">1</int>
>
>       <int name="maxInspections">5</int>
>
>       <int name="minQueryLength">4</int>
>
>       <float name="maxQueryFrequency">0.01</float>
>
>     </lst>
> </searchComponent>
>
> Also, below are the parameters, passing into Solr params:
>
>             solrParams.add("spellcheck.dictionary", "default");
>             solrParams.add("spellcheck.extendedResults", "true");
>             solrParams.add("spellcheck.count", "10");
>             solrParams.add("spellcheck.alternativeTermCount", "5");
>             solrParams.add("spellcheck.maxResultsForSuggest", "5");
>             solrParams.add("spellcheck.collate", "true");
>             solrParams.add("spellcheck.collateExtendedResults", "true");
>             solrParams.add("spellcheck.maxCollationTries", "10");
>             solrParams.add("spellcheck.maxCollations", "5");
>             solrParams.add("spellcheck.onlyMorePopular", "false");
>
> is Solr always provide the suggestions for correct words also ? Any
> pointers.
>
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>
-- 

*Regards,Rohan Kasat*

Re: Control Solr spellcheck functionality to provide suggestions for correct word

Posted by Rashi <ga...@gmail.com>.
Hi Rohan,

Sharing the configuration:

 <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
    <str name="queryAnalyzerFieldType">text_suggest</str>

    
    <lst name="spellchecker">
      <str name="name">default</str>
      <str name="field">title</str>
      <str name="classname">solr.DirectSolrSpellChecker</str>
      
      <str name="distanceMeasure">internal</str>
      
      <float name="accuracy">0.5</float>
      
      <int name="maxEdits">2</int>
      
      <int name="minPrefix">1</int>
      
      <int name="maxInspections">5</int>
      
      <int name="minQueryLength">4</int>
      
      <float name="maxQueryFrequency">0.01</float>
      
    </lst>
</searchComponent>

Also, below are the parameters, passing into Solr params:

            solrParams.add("spellcheck.dictionary", "default");
            solrParams.add("spellcheck.extendedResults", "true");
            solrParams.add("spellcheck.count", "10");
            solrParams.add("spellcheck.alternativeTermCount", "5");
            solrParams.add("spellcheck.maxResultsForSuggest", "5");
            solrParams.add("spellcheck.collate", "true");
            solrParams.add("spellcheck.collateExtendedResults", "true");
            solrParams.add("spellcheck.maxCollationTries", "10");
            solrParams.add("spellcheck.maxCollations", "5");
            solrParams.add("spellcheck.onlyMorePopular", "false");

is Solr always provide the suggestions for correct words also ? Any
pointers.




--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Re: Control Solr spellcheck functionality to provide suggestions for correct word

Posted by Rohan Kasat <ro...@gmail.com>.
Hi Rashi,

Can you share your spellcheck configuration, it will be easy to check from
the configuration?

Regards,
Rohan Kasat

On Fri, Apr 5, 2019 at 10:29 AM rashi gandhi <ga...@gmail.com>
wrote:

> HI,
>
> I am working on Solr spellcheck feature, and I am using index based
> spellcheck dictionary as a source for spellcheck suggestions.
> I observed that collated results returned by spellcheck component, provide
> the suggestions for misspelled words, however also provide suggestions for
> correctly spelled word in query.
>
> For example,
>  misspelled query - root priviladge to user
>
> *collated results (even suggestion includes the same) *-
> root privilege to user, room privilege to user, root privilege to users,
> rest privilege to user, root privilege to used
>
> It corrected word 'privilege' which was misspelled, however also provided
> suggestions for 'root' or 'user', which were already correct.
>
> is there a way , we can tell Solr not to provide suggestions for correct
> word, when using spellcheck feature.
>
> Please provide pointers.
>
-- 

*Regards,Rohan Kasat*