lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cpoersc...@apache.org
Subject lucene-solr:master: LUCENE-7356: SearchGroup tweaks (initialCapacity, size==0 vs. isEmpty)
Date Tue, 28 Jun 2016 11:42:54 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master 9cbd54087 -> e0c45f400


LUCENE-7356: SearchGroup tweaks (initialCapacity, size==0 vs. isEmpty)


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/e0c45f40
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/e0c45f40
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/e0c45f40

Branch: refs/heads/master
Commit: e0c45f400f83aab397b58ff2f83b2b11229576a7
Parents: 9cbd540
Author: Christine Poerschke <cpoerschke@apache.org>
Authored: Tue Jun 28 11:03:03 2016 +0100
Committer: Christine Poerschke <cpoerschke@apache.org>
Committed: Tue Jun 28 12:42:11 2016 +0100

----------------------------------------------------------------------
 lucene/CHANGES.txt                                           | 2 ++
 .../java/org/apache/lucene/search/grouping/SearchGroup.java  | 8 ++++----
 2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e0c45f40/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 9eea9e2..e0f11c3 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -70,6 +70,8 @@ Optimizations
 
 * LUCENE-7330, LUCENE-7339: Speed up conjunction queries. (Adrien Grand)
 
+* LUCENE-7356: SearchGroup tweaks. (Christine Poerschke)
+
 Other
 
 * LUCENE-4787: Fixed some highlighting javadocs. (Michael Dodsworth via Adrien

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e0c45f40/lucene/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java
----------------------------------------------------------------------
diff --git a/lucene/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java b/lucene/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java
index c9d7fa0..b3a43cb 100644
--- a/lucene/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java
+++ b/lucene/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java
@@ -288,11 +288,11 @@ public class SearchGroup<GROUP_VALUE_TYPE> {
       }
 
       // Pull merged topN groups:
-      final List<SearchGroup<T>> newTopGroups = new ArrayList<>();
+      final List<SearchGroup<T>> newTopGroups = new ArrayList<>(topN);
 
       int count = 0;
 
-      while(queue.size() != 0) {
+      while(!queue.isEmpty()) {
         final MergedGroup<T> group = queue.pollFirst();
         group.processed = true;
         //System.out.println("  pop: shards=" + group.shards + " group=" + (group.groupValue
== null ? "null" : (((BytesRef) group.groupValue).utf8ToString())) + " sortValues=" + Arrays.toString(group.topValues));
@@ -314,7 +314,7 @@ public class SearchGroup<GROUP_VALUE_TYPE> {
         }
       }
 
-      if (newTopGroups.size() == 0) {
+      if (newTopGroups.isEmpty()) {
         return null;
       } else {
         return newTopGroups;
@@ -333,7 +333,7 @@ public class SearchGroup<GROUP_VALUE_TYPE> {
    */
   public static <T> Collection<SearchGroup<T>> merge(List<Collection<SearchGroup<T>>>
topGroups, int offset, int topN, Sort groupSort)
     throws IOException {
-    if (topGroups.size() == 0) {
+    if (topGroups.isEmpty()) {
       return null;
     } else {
       return new GroupMerger<T>(groupSort).merge(topGroups, offset, topN);


Mime
View raw message