Nalini,

Right now the best you can do is to use <copyField> to combine everything into 
a catch-all for spellchecking purposes.  While this seems wasteful, this often 
has to be done anyhow because typically you'll need less/different analysis for 
spellchecking than for searching.  But rather than having separate <copyField>s 
to create multiple dictionaries, put everything into one field to create a 
single "master" dictionary.

>From there, you need to set "spellcheck.collate" to true and also 
>"spellcheck.maxCollationTries" greater than zero (5-10 usually works).  The 
>first parameter tells it to generate re-written queries with spelling 
>suggestions (collations).  The second parameter tells it to weed out any 
>collations that won't generate hits if you re-query them.  This is important 
>because having unrelated keywords in your master dictionary will increase the 
>chances the spellchecker will pick the wrong words as corrections.

There is a significant caveat to this:  The spellchecker typically only 
suggests for words in the dictionary.  So by creating a huge, master dictionary 
you might find that many misspelled words won't generate suggestions.  See this 
thread for some workarounds:  
http://lucene.472066.n3.nabble.com/Improving-Solr-Spell-Checker-Results-td3658411.html
  

I think having multiple, per-field dictionaries as you suggest might be a good 
way to go.  While this is not supported, I don't think its because of 
performance concerns.  (There would be an overhead cost to this but I think it 
would still be practical).  It just hasn't been implemented yet.  But we might 
be getting to a possible start to this type of functionality.  In 
https://issues.apache.org/jira/browse/SOLR-2585 a separate spellchecker is 
added that just corrects wordbreak (or is it "word break"?) problems, then a 
"ConjunctionSolrSpellChecker" combines the results from the main spellchecker 
and the wordbreak spellcheker.  I could see a next step beyond this being to 
support per-field dictionaries, checking them separately, then combining the 
results.

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

-----Original Message-----
From: Nalini Kartha [mailto:nalinikar...@gmail.com] 
Sent: Wednesday, January 25, 2012 11:56 AM
To: solr-user@lucene.apache.org
Subject: Using multiple DirectSolrSpellcheckers for a query

Hi,

We are trying to use the DirectSolrSpellChecker to get corrections for
mis-spelled query terms directly from fields in the Solr index.

However, we need to use multiple fields for spellchecking a query. It looks
looks like you can only use one spellchecker for a request and so the
workaround for this it to create a copy field from the fields required for
spell correction?

We'd like to avoid this because we allow users to perform different kinds
of queries on different sets of fields and so to provide meaningful
corrections we'd have to create multiple copy fields - one for each query
type.

Is there any reason why Solr doesn't support using multiple spellcheckers
for a query? Is it because of performance overhead?

Thanks,
Nalini

Reply via email to