mirror of https://github.com/apache/lucene.git
SOLR-1094 -- Incorrect value of correctlySpelled attribute in some cases
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@769310 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d7f7ca176f
commit
809a559b63
|
@ -347,6 +347,8 @@ Bug Fixes
|
|||
|
||||
38. SOLR-1126: Replicated files have incorrect timestamp (Jian Han Guo, Jeff Newburn, Noble Paul via shalin)
|
||||
|
||||
39. SOLR-1094: Incorrect value of correctlySpelled attribute in some cases (David Smiley, mark Miller via shalin)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
1. Upgraded to Lucene 2.4.0 (yonik)
|
||||
|
|
|
@ -186,11 +186,17 @@ public class SpellCheckComponent extends SearchComponent implements SolrCoreAwar
|
|||
NamedList result = new NamedList();
|
||||
Map<Token, LinkedHashMap<String, Integer>> suggestions = spellingResult.getSuggestions();
|
||||
boolean hasFreqInfo = spellingResult.hasTokenFrequencyInfo();
|
||||
boolean isCorrectlySpelled = true;
|
||||
boolean isCorrectlySpelled = false;
|
||||
Map<Token, String> best = null;
|
||||
if (collate == true){
|
||||
best = new LinkedHashMap<Token, String>(suggestions.size());
|
||||
}
|
||||
|
||||
// will be flipped to false if any of the suggestions are not in the index and hasFreqInfo is true
|
||||
if(suggestions.size() > 0) {
|
||||
isCorrectlySpelled = true;
|
||||
}
|
||||
|
||||
for (Map.Entry<Token, LinkedHashMap<String, Integer>> entry : suggestions.entrySet()) {
|
||||
Token inputToken = entry.getKey();
|
||||
Map<String, Integer> theSuggestions = entry.getValue();
|
||||
|
|
|
@ -258,6 +258,19 @@ public class SpellCheckComponentTest extends AbstractSolrTestCase {
|
|||
assertQ("Make sure correct spellings are signalled in the response", req,
|
||||
"//*[@numFound='1']", "//result/doc[1]/int[@name='id'][.='1']",
|
||||
"//*/lst[@name='suggestions']");
|
||||
|
||||
|
||||
args = new HashMap<String, String>();
|
||||
|
||||
args.put(CommonParams.Q, "lakkle");
|
||||
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='0']", "//*/lst[@name='suggestions']", "//*/bool[@name='correctlySpelled'][.='false']");
|
||||
}
|
||||
|
||||
public void testInit() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue