If you're using Solr3.1 or higher, you can do this. See http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.collate . Here's a summary:
- specify "spellcheck.collate=true" to get a re-written query made from the individual word suggestions. - specify "spellcheck.maxCollationTries" to something >0 (10, perhaps) to have it "try" the collation possibilities against the index before returning them to the user. This means that all collations returned will be guaranteed to return hits. - specify "spellcheck.collateExtendedResults=true" if you want hit counts for the collation queries and also details on which original word was replaced by which new word. - specify "spellcheck.maxCollations" to something >1 if you want to get more than 1 collation returned. If on 4.0-alpha: - maybe specify "spellcheck.collateParam.mm=100%", if your original query had a very low "mm" value. This will make the collations returned more meaningful to the user. - maybe specify "spellcheck.alternativeTermCount" to something >0 if you want the spellchecker to consider that the user might have misspelled words even though the misspelling occurs somewhere in the index. James Dyer E-Commerce Systems Ingram Content Group (615) 213-4311 -----Original Message----- From: ninaddesai82 [mailto:desai.ni...@gmail.com] Sent: Friday, July 06, 2012 6:04 AM To: solr-user@lucene.apache.org Subject: Better (and valid) Spellcheck in combination with other parameters with at least one occurance Hi, I am trying to implement solr search with spellcheck. - My current seach works like this - I have some specific criteria for every search query. i.e. If I am hitting search with q=restaurants , I also pass another param say c=mumbai. So solr returns me restaurants in mumbai. Now I want to implement spellcheck, but at the same time I also want to make sure that whatever results my spellcheck is providing, are valid (means have at least one occurance in combination with my other param as in c=city). I am not able to decide how to achieve that. i.e. If I pass say "hangry" to solr with spell check then spell check retuerns few suggestions like "hungry", "angry" However I want to suggest user only those suggestions which have hitcounts in my data with common field as in c=mumbai. Otherwise what happens is - solr returns me some suggestion words "hungry , angry" and if they dont have ny records with combination of city, it returns no result, which is bad user experience. so ideally Solr should return me suggestion for only those words which have at least 1 count for that suggestion with mumbai. I am currently firing 2 queries to luscene in order to achieve this Query one - spellcheck - this gives me word suggestns Query two - with given words in spell check i run facet query to get occurance counts to check which ones are valid. But this seems like unnecessary over head (Query two - with facet takes too long to respond as well). And I am trying to find more optimized way to do this. Can anyone suggest me how to do that ? thanks, ndesai -- View this message in context: http://lucene.472066.n3.nabble.com/Better-and-valid-Spellcheck-in-combination-with-other-parameters-with-at-least-one-occurance-tp3993484.html Sent from the Solr - User mailing list archive at Nabble.com.