You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by sh...@apache.org on 2009/04/28 11:24:07 UTC
svn commit: r769310 - in /lucene/solr/trunk: CHANGES.txt
src/java/org/apache/solr/handler/component/SpellCheckComponent.java
src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java
Author: shalin
Date: Tue Apr 28 09:24:05 2009
New Revision: 769310
URL: http://svn.apache.org/viewvc?rev=769310&view=rev
Log:
SOLR-1094 -- Incorrect value of correctlySpelled attribute in some cases
Modified:
lucene/solr/trunk/CHANGES.txt
lucene/solr/trunk/src/java/org/apache/solr/handler/component/SpellCheckComponent.java
lucene/solr/trunk/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java
Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=769310&r1=769309&r2=769310&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Tue Apr 28 09:24:05 2009
@@ -347,6 +347,8 @@
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)
Modified: lucene/solr/trunk/src/java/org/apache/solr/handler/component/SpellCheckComponent.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/handler/component/SpellCheckComponent.java?rev=769310&r1=769309&r2=769310&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/handler/component/SpellCheckComponent.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/handler/component/SpellCheckComponent.java Tue Apr 28 09:24:05 2009
@@ -186,11 +186,17 @@
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();
Modified: lucene/solr/trunk/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java?rev=769310&r1=769309&r2=769310&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java (original)
+++ lucene/solr/trunk/src/test/org/apache/solr/handler/component/SpellCheckComponentTest.java Tue Apr 28 09:24:05 2009
@@ -255,9 +255,22 @@
SolrQueryRequest req = new LocalSolrQueryRequest(core, new MapSolrParams(
args));
- assertQ("Make sure correct spellings are signalled in the response", req,
+ 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 {