Elisabeth, Currently ConjunctionSolrSpellChecker only supports adding WordBreakSolrSpellchecker to IndexBased- FileBased- or DirectSolrSpellChecker. In the future, it would be great if it could handle other Spell Checker combinations. For instance, if you had a (e)dismax query that searches multiple fields, to have a separate spellchecker for each of them.
But CSSC is not hardened for this more general usage, as hinted in the API doc. The check done to ensure all spellcheckers use the same stringdistance object, I believe, is a safeguard against using this class for functionality it is not able to correctly support. It looks to me that SOLR-6271 was opened to fix the bug in that it is comparing references on the stringdistance. This is not a problem with WBSSC because this one does not support string distance at all. What you're hoping for, however, is that the requirement for the string distances be the same to be removed entirely. You could try modifying the code by removing the check. However beware that you might not get the results you desire! But should this happen, please, go ahead and fix it for your use case and then donate the code. This is something I've personally wanted for a long time. James Dyer Ingram Content Group -----Original Message----- From: elisabeth benoit [mailto:elisaelisael...@gmail.com] Sent: Tuesday, April 14, 2015 7:37 AM To: solr-user@lucene.apache.org Subject: using DirectSpellChecker and FileBasedSpellChecker with Solr 4.10.1 Hello, I am using Solr 4.10.1 and trying to use DirectSolrSpellChecker and FileBasedSpellchecker in same request. I've applied change from patch 135.patch (cf Solr-6271). I've tried running the command "patch -p1 -i 135.patch --dry-run" but it didn't work, maybe because the patch was a fix to Solr 4.9, so I just replaced line in ConjunctionSolrSpellChecker else if (!stringDistance.equals(checker.getStringDistance())) { throw new IllegalArgumentException( "All checkers need to use the same StringDistance."); } by else if (!stringDistance.equals(checker.getStringDistance())) { throw new IllegalArgumentException( "All checkers need to use the same StringDistance!!! 1:" + checker.getStringDistance() + " 2: " + stringDistance); } as it was done in the patch but still, when I send a spellcheck request, I get the error msg": "All checkers need to use the same StringDistance!!! 1:org.apache.lucene.search.spell.LuceneLevenshteinDistance@15f57db32: org.apache.lucene.search.spell.LuceneLevenshteinDistance@280f7e08" From error message I gather both spellchecker use same distanceMeasure LuceneLevenshteinDistance, but they're not same instance of LuceneLevenshteinDistance. Is the condition all right? What should be done to fix this properly? Thanks, Elisabeth