You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2011/11/17 10:00:42 UTC
svn commit: r1203119 - in /lucene/dev/branches/branch_3x: ./ lucene/
lucene/backwards/src/test/ solr/ solr/core/ solr/solrj/
solr/solrj/src/java/org/apache/solr/client/solrj/response/
solr/solrj/src/test/org/apache/solr/client/solrj/response/
Author: simonw
Date: Thu Nov 17 09:00:42 2011
New Revision: 1203119
URL: http://svn.apache.org/viewvc?rev=1203119&view=rev
Log:
SOLR-2902: List of collations are wrong parsed in SpellCheckResponse
Modified:
lucene/dev/branches/branch_3x/ (props changed)
lucene/dev/branches/branch_3x/lucene/ (props changed)
lucene/dev/branches/branch_3x/lucene/backwards/src/test/ (props changed)
lucene/dev/branches/branch_3x/solr/ (props changed)
lucene/dev/branches/branch_3x/solr/CHANGES.txt
lucene/dev/branches/branch_3x/solr/core/ (props changed)
lucene/dev/branches/branch_3x/solr/solrj/ (props changed)
lucene/dev/branches/branch_3x/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java
lucene/dev/branches/branch_3x/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java
Modified: lucene/dev/branches/branch_3x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/CHANGES.txt?rev=1203119&r1=1203118&r2=1203119&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/solr/CHANGES.txt Thu Nov 17 09:00:42 2011
@@ -108,6 +108,10 @@ Bug Fixes
* SOLR-2829: Fix problem with false-positives due to incorrect
equals methods. (Yonik Seeley, Hossman, Erick Erickson.
Marc Tinnemeyer caught the bug)
+
+* SOLR-2902: List of collations are wrong parsed in SpellCheckResponse causing
+ a wrong number of collation results in the response.
+ (Bastiaan Verhoef, James Dyer via Simon Willnauer)
Other Changes
----------------------
Modified: lucene/dev/branches/branch_3x/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java?rev=1203119&r1=1203118&r2=1203119&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java (original)
+++ lucene/dev/branches/branch_3x/solr/solrj/src/java/org/apache/solr/client/solrj/response/SpellCheckResponse.java Thu Nov 17 09:00:42 2011
@@ -53,7 +53,7 @@ public class SpellCheckResponse {
for (Object o : collationInfo) {
if (o instanceof String) {
collations.add(new Collation()
- .setCollationQueryString((String) sugg.getVal(i)));
+ .setCollationQueryString((String) o));
} else if (o instanceof NamedList) {
NamedList expandedCollation = (NamedList) o;
String collationQuery = (String) expandedCollation
Modified: lucene/dev/branches/branch_3x/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java?rev=1203119&r1=1203118&r2=1203119&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java (original)
+++ lucene/dev/branches/branch_3x/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java Thu Nov 17 09:00:42 2011
@@ -150,7 +150,7 @@ public class TestSpellCheckResponse exte
assertTrue("name:(+faith +hope +love)".equals(response.getCollatedResult()) || "name:(+faith +hope +loaves)".equals(response.getCollatedResult()));
List<Collation> collations = response.getCollatedResults();
- assertTrue(collations.size()==2);
+ assertEquals(2, collations.size());
for(Collation collation : collations)
{
assertTrue("name:(+faith +hope +love)".equals(collation.getCollationQueryString()) || "name:(+faith +hope +loaves)".equals(collation.getCollationQueryString()));
@@ -174,7 +174,20 @@ public class TestSpellCheckResponse exte
fail("Original Word Should have been either fauth, home or loane.");
}
}
-
+ }
+
+ query.set(SpellingParams.SPELLCHECK_COLLATE_EXTENDED_RESULTS, false);
+ response = request.process(server).getSpellCheckResponse();
+ {
+ collations = response.getCollatedResults();
+ assertEquals(2, collations.size());
+ String collation1 = collations.get(0).getCollationQueryString();
+ String collation2 = collations.get(1).getCollationQueryString();
+ assertFalse(collation1 + " equals " + collation2,
+ collation1.equals(collation2));
+ for(Collation collation : collations) {
+ assertTrue("name:(+faith +hope +love)".equals(collation.getCollationQueryString()) || "name:(+faith +hope +loaves)".equals(collation.getCollationQueryString()));
+ }
}
}