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 Daniel Borup <db...@alpha-solutions.dk> on 2013/11/11 14:38:06 UTC

spellcheck solr 4.3.1

Hey

I am running af solr 4.3.1 and working is implementing spellcheck using solr.DirectSolrSpellChecker everything seems to be working  fine but at have one issue.

If I search for
http://localhost:8765/solr/MainIndex/spell?q=kim%20AND%20larsen

the result is some hits and the spell component return the following structure.

<lst name="spellcheck">
<lst name="suggestions">
<bool name="correctlySpelled">true</bool>
</lst>
</lst>
I would have liked that if some suggest were found they were return....

If I do a search for
http://localhost:8765/solr/MainIndex/spell?q=kim%20AND%20larsenn

with larsen spelled wrong (larsenn) the spell component return the following:

<lst name="spellcheck">
<lst name="suggestions">
<lst name="larsenn">
<int name="numFound">1</int>
<int name="startOffset">8</int>
<int name="endOffset">15</int>
<int name="origFreq">0</int>
<arr name="suggestion">
<lst>
<str name="word">larsen</str>
<int name="freq">12</int>
</lst>
</arr>
</lst>
<bool name="correctlySpelled">false</bool>
<lst name="collation">
<str name="collationQuery">kim AND larsen</str>
<int name="hits">12</int>
<lst name="misspellingsAndCorrections">
<str name="kim">kim</str>
<str name="larsenn">larsen</str>
</lst>
</lst>
</lst>
</lst>

In my point of view this is correct but, if I do the same search as above just as an OR search http://localhost:8765/solr/MainIndex/spell?q=kim%20OR%20larsenn
The spell component return some result and:

<lst name="spellcheck">
<lst name="suggestions">
<bool name="correctlySpelled">true</bool>
</lst>
</lst>

larsenn now is spelled corrected according to solr, I cannot understand this behavior. Is there a setting to adjust the spell component so it always return suggestions ? or a way to have suggest in OR search with one wrong word working?






Med venlig hilsen / Best regards

Daniel Borup
Tel: (+45) 28 87 69 18
E-mail: db@alpha-solutions.dk<ma...@alpha-solutions.dk>

Alpha Solutions A/S
Sølvgade 10, 1.sal, DK-1307 Copenhagen K
Tel: (+45) 70 20 65 38
Web: www.alpha-solutions.dk<http://www.alpha-solutions.dk/>


** This message including any attachments may contain confidential and/or privileged information
intended only for the person or entity to which it is addressed. If you are not the intended recipient
you should delete this message. Any printing, copying, distribution or other use of this message is strictly prohibited.
If you have received this message in error, please notify the sender immediately by telephone
or e-mail and delete all copies of this message and any attachments from your system. Thank you.


SV: spellcheck solr 4.3.1

Posted by Daniel Borup <db...@alpha-solutions.dk>.
Hi

My spell requesthandler looks like this

<requestHandler name="/spell" class="solr.SearchHandler" startup="lazy">
    <lst name="defaults">
      <str name="df">spell</str>
      <!-- Solr will use suggestions from both the 'default' spellchecker
           and from the 'wordbreak' spellchecker and combine them.
           collations (re-written queries) can include a combination of
           corrections from both spellcheckers -->
      <str name="spellcheck.dictionary">default</str>
      <str name="spellcheck.dictionary">wordbreak</str>
      <str name="spellcheck">on</str>
      <str name="spellcheck.extendedResults">true</str>       
      <str name="spellcheck.count">10</str>
      <str name="spellcheck.alternativeTermCount">5</str>
      <str name="spellcheck.maxResultsForSuggest">5</str>       
      <str name="spellcheck.collate">true</str>
      <str name="spellcheck.collateExtendedResults">true</str>  
      <str name="spellcheck.maxCollationTries">10</str>
      <str name="spellcheck.maxCollations">5</str>         
    </lst>
    <arr name="last-components">
      <str>spellcheck</str>
    </arr>
  </requestHandler>

As you see the parameter spellcheck.maxResultsForSuggest is set to 5  

To my surprise removing the parameter completely seams to solve the problem, I will keep on testing the impact when removing this parameter. Thanks for the fast response      


Med venlig hilsen / Best regards

Daniel Borup
Tel: (+45) 28 87 69 18
E-mail: db@alpha-solutions.dk

-----Oprindelig meddelelse-----
Fra: Dyer, James [mailto:James.Dyer@ingramcontent.com] 
Sendt: 11. november 2013 15:54
Til: solr-user@lucene.apache.org
Emne: RE: spellcheck solr 4.3.1

There are 2 parameters you want to consider:

First is "spellcheck.maxResultsForSuggest".  Because you have an "OR" query, you'll get hits if only 1 query term is in the index.  This parameter lets you tune it to make it suggest if the query returns n or fewer hits.  My memory tells me, however, that if you leave this parameter out entirely, it will still return suggestions for "OR" queries with some misspelled words (false memory on my part?).  Possibly you have this set to 1?  Omitting it might be a better option.  See http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.maxResultsForSuggest .

Second is "collateParam", which lets you override certain query parameters when the spellchecker is testing collations against the index.  For instance, if you have "q.op=OR", the spellchecker will return collations that possibly only have 1 correct term.  The reason is it simply checks if a collation will return any hits.  So you can overide this with "spellcheck.collateParam.q.op=AND".  The same can be done for "mm" if using edismax.  See http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.collateParam.XX .

James Dyer
Ingram Content Group
(615) 213-4311

-----Original Message-----
From: Daniel Borup [mailto:db@alpha-solutions.dk]
Sent: Monday, November 11, 2013 7:38 AM
To: solr-user@lucene.apache.org
Subject: spellcheck solr 4.3.1

Hey

I am running af solr 4.3.1 and working is implementing spellcheck using solr.DirectSolrSpellChecker everything seems to be working  fine but at have one issue.

If I search for
http://localhost:8765/solr/MainIndex/spell?q=kim%20AND%20larsen

the result is some hits and the spell component return the following structure.

<lst name="spellcheck">
<lst name="suggestions">
<bool name="correctlySpelled">true</bool>
</lst>
</lst>
I would have liked that if some suggest were found they were return....

If I do a search for
http://localhost:8765/solr/MainIndex/spell?q=kim%20AND%20larsenn

with larsen spelled wrong (larsenn) the spell component return the following:

<lst name="spellcheck">
<lst name="suggestions">
<lst name="larsenn">
<int name="numFound">1</int>
<int name="startOffset">8</int>
<int name="endOffset">15</int>
<int name="origFreq">0</int>
<arr name="suggestion">
<lst>
<str name="word">larsen</str>
<int name="freq">12</int>
</lst>
</arr>
</lst>
<bool name="correctlySpelled">false</bool>
<lst name="collation">
<str name="collationQuery">kim AND larsen</str> <int name="hits">12</int> <lst name="misspellingsAndCorrections">
<str name="kim">kim</str>
<str name="larsenn">larsen</str>
</lst>
</lst>
</lst>
</lst>

In my point of view this is correct but, if I do the same search as above just as an OR search http://localhost:8765/solr/MainIndex/spell?q=kim%20OR%20larsenn
The spell component return some result and:

<lst name="spellcheck">
<lst name="suggestions">
<bool name="correctlySpelled">true</bool>
</lst>
</lst>

larsenn now is spelled corrected according to solr, I cannot understand this behavior. Is there a setting to adjust the spell component so it always return suggestions ? or a way to have suggest in OR search with one wrong word working?






Med venlig hilsen / Best regards

Daniel Borup
Tel: (+45) 28 87 69 18
E-mail: db@alpha-solutions.dk<ma...@alpha-solutions.dk>

Alpha Solutions A/S
Sølvgade 10, 1.sal, DK-1307 Copenhagen K
Tel: (+45) 70 20 65 38
Web: www.alpha-solutions.dk<http://www.alpha-solutions.dk/>


** This message including any attachments may contain confidential and/or privileged information intended only for the person or entity to which it is addressed. If you are not the intended recipient you should delete this message. Any printing, copying, distribution or other use of this message is strictly prohibited.
If you have received this message in error, please notify the sender immediately by telephone or e-mail and delete all copies of this message and any attachments from your system. Thank you.


RE: spellcheck solr 4.3.1

Posted by "Dyer, James" <Ja...@ingramcontent.com>.
There are 2 parameters you want to consider:

First is "spellcheck.maxResultsForSuggest".  Because you have an "OR" query, you'll get hits if only 1 query term is in the index.  This parameter lets you tune it to make it suggest if the query returns n or fewer hits.  My memory tells me, however, that if you leave this parameter out entirely, it will still return suggestions for "OR" queries with some misspelled words (false memory on my part?).  Possibly you have this set to 1?  Omitting it might be a better option.  See http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.maxResultsForSuggest .

Second is "collateParam", which lets you override certain query parameters when the spellchecker is testing collations against the index.  For instance, if you have "q.op=OR", the spellchecker will return collations that possibly only have 1 correct term.  The reason is it simply checks if a collation will return any hits.  So you can overide this with "spellcheck.collateParam.q.op=AND".  The same can be done for "mm" if using edismax.  See http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.collateParam.XX .

James Dyer
Ingram Content Group
(615) 213-4311

-----Original Message-----
From: Daniel Borup [mailto:db@alpha-solutions.dk] 
Sent: Monday, November 11, 2013 7:38 AM
To: solr-user@lucene.apache.org
Subject: spellcheck solr 4.3.1

Hey

I am running af solr 4.3.1 and working is implementing spellcheck using solr.DirectSolrSpellChecker everything seems to be working  fine but at have one issue.

If I search for
http://localhost:8765/solr/MainIndex/spell?q=kim%20AND%20larsen

the result is some hits and the spell component return the following structure.

<lst name="spellcheck">
<lst name="suggestions">
<bool name="correctlySpelled">true</bool>
</lst>
</lst>
I would have liked that if some suggest were found they were return....

If I do a search for
http://localhost:8765/solr/MainIndex/spell?q=kim%20AND%20larsenn

with larsen spelled wrong (larsenn) the spell component return the following:

<lst name="spellcheck">
<lst name="suggestions">
<lst name="larsenn">
<int name="numFound">1</int>
<int name="startOffset">8</int>
<int name="endOffset">15</int>
<int name="origFreq">0</int>
<arr name="suggestion">
<lst>
<str name="word">larsen</str>
<int name="freq">12</int>
</lst>
</arr>
</lst>
<bool name="correctlySpelled">false</bool>
<lst name="collation">
<str name="collationQuery">kim AND larsen</str>
<int name="hits">12</int>
<lst name="misspellingsAndCorrections">
<str name="kim">kim</str>
<str name="larsenn">larsen</str>
</lst>
</lst>
</lst>
</lst>

In my point of view this is correct but, if I do the same search as above just as an OR search http://localhost:8765/solr/MainIndex/spell?q=kim%20OR%20larsenn
The spell component return some result and:

<lst name="spellcheck">
<lst name="suggestions">
<bool name="correctlySpelled">true</bool>
</lst>
</lst>

larsenn now is spelled corrected according to solr, I cannot understand this behavior. Is there a setting to adjust the spell component so it always return suggestions ? or a way to have suggest in OR search with one wrong word working?






Med venlig hilsen / Best regards

Daniel Borup
Tel: (+45) 28 87 69 18
E-mail: db@alpha-solutions.dk<ma...@alpha-solutions.dk>

Alpha Solutions A/S
Sølvgade 10, 1.sal, DK-1307 Copenhagen K
Tel: (+45) 70 20 65 38
Web: www.alpha-solutions.dk<http://www.alpha-solutions.dk/>


** This message including any attachments may contain confidential and/or privileged information
intended only for the person or entity to which it is addressed. If you are not the intended recipient
you should delete this message. Any printing, copying, distribution or other use of this message is strictly prohibited.
If you have received this message in error, please notify the sender immediately by telephone
or e-mail and delete all copies of this message and any attachments from your system. Thank you.