lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r1145747 - in /lucene/dev/trunk/solr/core/src: java/org/apache/solr/search/Grouping.java test/org/apache/solr/TestGroupingSearch.java
Date Tue, 12 Jul 2011 20:16:54 GMT
Author: mvg
Date: Tue Jul 12 20:16:54 2011
New Revision: 1145747

URL: http://svn.apache.org/viewvc?rev=1145747&view=rev
Log:
fixed bug when start is bigger than rows and format is simple that zero documents are returned
even if there are documents to display.

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/Grouping.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestGroupingSearch.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/Grouping.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/Grouping.java?rev=1145747&r1=1145746&r2=1145747&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/Grouping.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/search/Grouping.java Tue Jul 12 20:16:54
2011
@@ -585,12 +585,7 @@ public class Grouping {
         }
       }
 
-      int len = docsGathered - offset;
-      if (offset > len) {
-        len = 0;
-      }
-
-      int[] docs = ArrayUtils.toPrimitive(ids.toArray(new Integer[ids.size()]));
+      int len = docsGathered - offset;int[] docs = ArrayUtils.toPrimitive(ids.toArray(new
Integer[ids.size()]));
       float[] docScores = ArrayUtils.toPrimitive(scores.toArray(new Float[scores.size()]));
       DocSlice docSlice = new DocSlice(offset, len, docs, docScores, getMatches(), maxScore);
 

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestGroupingSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestGroupingSearch.java?rev=1145747&r1=1145746&r2=1145747&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestGroupingSearch.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestGroupingSearch.java Tue Jul 12
20:16:54 2011
@@ -199,6 +199,21 @@ public class TestGroupingSearch extends 
     );
   }
 
+  @Test
+  public void testGroupingSimpleFormatStartBiggerThanRows() throws Exception {
+    assertU(add(doc("id", "1")));
+    assertU(add(doc("id", "2")));
+    assertU(add(doc("id", "3")));
+    assertU(add(doc("id", "4")));
+    assertU(add(doc("id", "5")));
+    assertU(commit());
+
+    assertJQ(
+        req("q", "*:*", "start", "2", "rows", "1", "group", "true", "group.field", "id",
"group.main", "true"),
+        "/response=={'numFound':5,'start':2,'docs':[{'id':'3'}]}"
+    );
+  }
+
   static String f = "foo_i";
   static String f2 = "foo2_i";
 



Mime
View raw message