dsmiley commented on a change in pull request #1395: SOLR-14365: 
CollapsingQParser - Avoiding always allocate int[] and float[] with size equals 
to number of unique values (WIP)
URL: https://github.com/apache/lucene-solr/pull/1395#discussion_r405252783
 
 

 ##########
 File path: 
solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java
 ##########
 @@ -2258,29 +2215,20 @@ public void collapse(int collapseKey, int contextDoc, 
int globalDoc) throws IOEx
         final int idx;
         if((idx = cmap.indexOf(collapseKey)) >= 0) {
           int pointer = cmap.indexGet(idx);
-          if(comp.test(currentVal, testValues[pointer])) {
-            testValues[pointer]= currentVal;
-            docs[pointer] = globalDoc;
+          if(comp.test(currentVal, testValues.get(pointer))) {
+            testValues.set(pointer, currentVal);
+            docs.set(pointer, globalDoc);
             if(needsScores) {
-              scores[pointer] = scorer.score();
+              scores.set(pointer, scorer.score());
             }
           }
         } else {
           ++index;
           cmap.put(collapseKey, index);
-          if(index == testValues.length) {
-            testValues = ArrayUtil.grow(testValues);
 
 Review comment:
   Thanks for pointing that out; I had thought the numerical range was 
pre-determined but I see in this scenario (numeric DocValues), it is not.  Keep 
the resizing in there then; as long as the other cases we size correctly 
up-front.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to