You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2010/11/21 23:00:04 UTC

svn commit: r1037571 - in /lucene/dev/trunk/solr/src/java/org/apache/solr: search/Grouping.java util/SentinelIntSet.java

Author: yonik
Date: Sun Nov 21 22:00:04 2010
New Revision: 1037571

URL: http://svn.apache.org/viewvc?rev=1037571&view=rev
Log:
SOLR-2068: fix bugs, but leave disabled due to missing support for null values

Modified:
    lucene/dev/trunk/solr/src/java/org/apache/solr/search/Grouping.java
    lucene/dev/trunk/solr/src/java/org/apache/solr/util/SentinelIntSet.java

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/search/Grouping.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/search/Grouping.java?rev=1037571&r1=1037570&r2=1037571&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/search/Grouping.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/search/Grouping.java Sun Nov 21 22:00:04 2010
@@ -707,9 +707,9 @@ class SearchGroupDocs {
 
 class Phase2StringGroupCollector extends Phase2GroupCollector {
   FieldCache.DocTermsIndex index;
-  SentinelIntSet ordSet;
-  SearchGroupDocs[] groups;
-  BytesRef spare;
+  final SentinelIntSet ordSet;
+  final SearchGroupDocs[] groups;
+  final BytesRef spare = new BytesRef();
 
   public Phase2StringGroupCollector(TopGroupCollector topGroups, ValueSource groupByVS, Map vsContext, Sort sort, int docsPerGroup, boolean getScores, int offset) throws IOException {
     super(topGroups, groupByVS, vsContext,sort,docsPerGroup,getScores,offset);

Modified: lucene/dev/trunk/solr/src/java/org/apache/solr/util/SentinelIntSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/java/org/apache/solr/util/SentinelIntSet.java?rev=1037571&r1=1037570&r2=1037571&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/java/org/apache/solr/util/SentinelIntSet.java (original)
+++ lucene/dev/trunk/solr/src/java/org/apache/solr/util/SentinelIntSet.java Sun Nov 21 22:00:04 2010
@@ -30,7 +30,7 @@ public class SentinelIntSet {
     this.emptyVal = emptyVal;
     int tsize = Math.max(org.apache.lucene.util.BitUtil.nextHighestPowerOfTwo(size), 1);
     rehashCount = tsize - (tsize>>2);
-    if (tsize <= rehashCount) {
+    if (size >= rehashCount) {  // should be able to hold "size" w/o rehashing
       tsize <<= 1;
       rehashCount = tsize - (tsize>>2);
     }
@@ -117,6 +117,8 @@ public class SentinelIntSet {
     startRehash(newSize);
     int[] oldKeys = keys;
     keys = new int[newSize];
+    if (emptyVal != 0) Arrays.fill(keys, emptyVal);
+
     for (int i=0; i<oldKeys.length; i++) {
       int key = oldKeys[i];
       if (key == emptyVal) continue;