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 abhayd <aj...@hotmail.com> on 2010/10/28 23:33:58 UTC

spellchecker results not as desired

hi 

I added spellchecker to request handler. Spellchecker is indexed based.
Terms in index are like
iphone
iphone 4
iphone case
phone
gophoe

when i set q=iphole i get suggestions like
iphone
phone
gophone
ipad

Not sure how would i get iphone, iphone 4, iphone case, phone. Any thoughts?

At the same time when i type ipj
i get result as ipad, why not iphone, iphone 4 , ipad
-- 
View this message in context: http://lucene.472066.n3.nabble.com/spellchecker-results-not-as-desired-tp1789192p1789192.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: spellchecker results not as desired

Posted by "Dyer, James" <Ja...@ingrambook.com>.
You should be building your index on a field that creates tokens on whitespace.  So your dictionary would have "iphone" and "case" as separate terms instead of "iphone case" as one term.  And if you query on something like "iphole case", it will give suggestions for "iphole" but not for "case" because the later is in the dictionary.  (The spellchecker will always assume a term is correctly spelled if it is in the Dictionary).

If you set collate=true, in addition to getting word-by-word suggestions, it will return a re-written query (aka a "collation").  SOLR 1.4 wil always use the top suggestions for each word to form the collation.  In this example, the collation would be "iphone case".  You can then requery SOLR with the collation and hope to get better hits.  While 1.4 doesn't check to see if the collation is going to return any hits, an enhancement to 3.x and 4.0 allows you to guarantee that collations will always give you hits if you requery them.

As for your second question, likely "ipj" is close enough to "ipad" to warrant a suggestion but the others are not considered close enough.  You can tweak this by setting spellcheck.accuracy.  However, I do not believe this option is available in 1.4.  The wiki indicates it is 3.x/4.0 only.

For more information, look at the "SpellCheckComponent" page on the wiki.

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: abhayd [mailto:ajdabholkar@hotmail.com] 
Sent: Thursday, October 28, 2010 4:34 PM
To: solr-user@lucene.apache.org
Subject: spellchecker results not as desired


hi 

I added spellchecker to request handler. Spellchecker is indexed based.
Terms in index are like
iphone
iphone 4
iphone case
phone
gophoe

when i set q=iphole i get suggestions like
iphone
phone
gophone
ipad

Not sure how would i get iphone, iphone 4, iphone case, phone. Any thoughts?

At the same time when i type ipj
i get result as ipad, why not iphone, iphone 4 , ipad
-- 
View this message in context: http://lucene.472066.n3.nabble.com/spellchecker-results-not-as-desired-tp1789192p1789192.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: spellchecker results not as desired

Posted by abhayd <aj...@hotmail.com>.
Thanks,
I was able to fix this issue with combination of EdgeNGrams and fuzzy query.

here are details 
http://www.lucidimagination.com/blog/2009/09/08/auto-suggest-from-popular-queries-using-edgengrams/

I just added fuzzyquery operator and seems to be working so far
-- 
View this message in context: http://lucene.472066.n3.nabble.com/spellchecker-results-not-as-desired-tp1789192p2012887.html
Sent from the Solr - User mailing list archive at Nabble.com.