SOLR-2902: List of collations are wrong parsed in SpellCheckResponse

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1203114 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2011-11-17 08:55:10 +00:00
parent 2a94133a2c
commit 87ac7de453
3 changed files with 20 additions and 3 deletions

View File

@ -434,6 +434,10 @@ Bug Fixes
* SOLR-2813: Fix HTTP error codes returned when requests contain strings that
can not be parsed as numbers for Trie fields. (Jeff Crump and hossman)
* 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
----------------------

View File

@ -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) {
@SuppressWarnings("unchecked")
NamedList<Object> expandedCollation = (NamedList<Object>) o;

View File

@ -150,7 +150,7 @@ public class TestSpellCheckResponse extends SolrJettyTestBase {
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 extends SolrJettyTestBase {
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()));
}
}
}