lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r1212420 - in /lucene/dev/trunk/solr: CHANGES.txt core/src/java/org/apache/solr/handler/component/QueryComponent.java core/src/test/org/apache/solr/TestDistributedGrouping.java
Date Fri, 09 Dec 2011 13:49:04 GMT
Author: mvg
Date: Fri Dec  9 13:49:03 2011
New Revision: 1212420

URL: http://svn.apache.org/viewvc?rev=1212420&view=rev
Log:
SOLR-2955: Fixed IllegalStateException when querying with group.sort=score desc in sharded
environment.

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1212420&r1=1212419&r2=1212420&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Fri Dec  9 13:49:03 2011
@@ -418,6 +418,9 @@ Bug Fixes
   
 * SOLR-2509: StringIndexOutOfBoundsException in the spellchecker collate when the term contains
   a hyphen. (Thomas Gambier caught the bug, Steffen Godskesen did the patch, via Erick Erickson)
+
+* SOLR-2955: Fixed IllegalStateException when querying with group.sort=score desc in sharded
+             environment. (Steffen Elberg Godskesen, Martijn van Groningen)
   
 Other Changes
 ----------------------

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java?rev=1212420&r1=1212419&r2=1212420&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
(original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
Fri Dec  9 13:49:03 2011
@@ -162,13 +162,18 @@ public class QueryComponent extends Sear
 
     //TODO: move weighting of sort
     Sort groupSort = searcher.weightSort(cmd.getSort());
-    // groupSort defaults to sort
-    String groupSortStr = params.get(GroupParams.GROUP_SORT);
     if (groupSort == null) {
-      groupSort = new Sort();
+      groupSort = Sort.RELEVANCE;
     }
+
+    // groupSort defaults to sort
+    String groupSortStr = params.get(GroupParams.GROUP_SORT);
     //TODO: move weighting of sort
     Sort sortWithinGroup = groupSortStr == null ?  groupSort : searcher.weightSort(QueryParsing.parseSort(groupSortStr,
req));
+    if (sortWithinGroup == null) {
+      sortWithinGroup = Sort.RELEVANCE;
+    }
+
     groupingSpec.setSortWithinGroup(sortWithinGroup);
     groupingSpec.setGroupSort(groupSort);
 

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java?rev=1212420&r1=1212419&r2=1212420&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java Fri Dec
 9 13:49:03 2011
@@ -140,6 +140,7 @@ public class TestDistributedGrouping ext
     query("q", "*:*", "fq", s1 + ":a", "rows", 100, "fl", "id," + i1, "group", "true", "group.field",
i1, "group.limit", 10, "sort", i1 + " asc, id asc", "group.truncate", "true", "facet", "true",
"facet.field", t1);
 
     // We cannot validate distributed grouping with scoring as first sort. since there is
no global idf. We can check if no errors occur
+    simpleQuery("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field",
i1, "group.limit", 10, "sort", i1 + " desc", "group.sort", "score desc"); // SOLR-2955
     simpleQuery("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field",
i1, "group.limit", 10, "sort", "score desc, _docid_ asc, id asc");
     simpleQuery("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field",
i1, "group.limit", 10);
   }
@@ -149,6 +150,7 @@ public class TestDistributedGrouping ext
     for (int i = 0; i < queryParams.length; i += 2) {
       params.add(queryParams[i].toString(), queryParams[i + 1].toString());
     }
+    params.set("shards", shards);
     queryServer(params);
   }
 



Mime
View raw message