SOLR-1094 followup -- Fix for single correctly spelled word

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@769357 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2009-04-28 12:16:22 +00:00
parent 809a559b63
commit cf2cbe45df
2 changed files with 15 additions and 0 deletions

View File

@ -227,6 +227,8 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
}
if (hasFreqInfo) {
result.add("correctlySpelled", isCorrectlySpelled);
} else if(extendedResults && suggestions.size() == 0) { // if the word is misspelled, its added to suggestions with freqinfo
result.add("correctlySpelled", true);
}
if (collate == true){
StringBuilder collation = new StringBuilder(origQuery);

View File

@ -271,6 +271,19 @@ public class SpellCheckComponentTest extends AbstractSolrTestCase {
assertQ("Make sure correct spellings are signalled in the response", req,
"//*[@numFound='0']", "//*/lst[@name='suggestions']", "//*/bool[@name='correctlySpelled'][.='false']");
args = new HashMap<String, String>();
args.put(CommonParams.Q, "lowerfilt:lazy");
args.put(CommonParams.QT, "spellCheckCompRH");
args.put(SpellCheckComponent.SPELLCHECK_EXTENDED_RESULTS, "true");
args.put(SpellCheckComponent.COMPONENT_NAME, "true");
req = new LocalSolrQueryRequest(core, new MapSolrParams(
args));
assertQ("Make sure correct spellings are signalled in the response", req,
"//*[@numFound='1']", "//*/lst[@name='suggestions']", "//*/bool[@name='correctlySpelled'][.='true']");
}
public void testInit() throws Exception {