You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2020/04/10 13:37:48 UTC

[lucene-solr] branch master updated: SOLR-14365: Automatically grow size of groupHeadValues

This is an automated email from the ASF dual-hosted git repository.

datcm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new 71d335f  SOLR-14365: Automatically grow size of groupHeadValues
71d335f is described below

commit 71d335ff688982cef10a648c914623c81ceeeeed
Author: Cao Manh Dat <da...@apache.org>
AuthorDate: Fri Apr 10 20:37:04 2020 +0700

    SOLR-14365: Automatically grow size of groupHeadValues
---
 .../src/java/org/apache/solr/search/CollapsingQParserPlugin.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java
index 61e4bed..9114f3d 100644
--- a/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java
+++ b/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java
@@ -2699,7 +2699,9 @@ public class CollapsingQParserPlugin extends QParserPlugin {
      */
     public void setGroupValues(int collapseKey, int contextDoc) throws IOException {
       assert 0 <= collapseKey : "negative collapseKey";
-      assert collapseKey < groupHeadValues.length : "collapseKey too big -- need to grow array?";
+      if (collapseKey >= groupHeadValues.length) {
+        grow(collapseKey + 1);
+      }
       setGroupValues(getOrInitGroupHeadValues(collapseKey), contextDoc);
     }
     
@@ -2733,7 +2735,9 @@ public class CollapsingQParserPlugin extends QParserPlugin {
      */
     public boolean testAndSetGroupValues(int collapseKey, int contextDoc) throws IOException {
       assert 0 <= collapseKey : "negative collapseKey";
-      assert collapseKey < groupHeadValues.length : "collapseKey too big -- need to grow array?";
+      if (collapseKey >= groupHeadValues.length) {
+        grow(collapseKey + 1);
+      }
       return testAndSetGroupValues(getOrInitGroupHeadValues(collapseKey), contextDoc);
     }