mirror of https://github.com/apache/lucene.git
LUCENE-7356: SearchGroup tweaks (initialCapacity, size==0 vs. isEmpty)
This commit is contained in:
parent
9cbd54087c
commit
e0c45f400f
|
@ -70,6 +70,8 @@ Optimizations
|
||||||
|
|
||||||
* LUCENE-7330, LUCENE-7339: Speed up conjunction queries. (Adrien Grand)
|
* LUCENE-7330, LUCENE-7339: Speed up conjunction queries. (Adrien Grand)
|
||||||
|
|
||||||
|
* LUCENE-7356: SearchGroup tweaks. (Christine Poerschke)
|
||||||
|
|
||||||
Other
|
Other
|
||||||
|
|
||||||
* LUCENE-4787: Fixed some highlighting javadocs. (Michael Dodsworth via Adrien
|
* LUCENE-4787: Fixed some highlighting javadocs. (Michael Dodsworth via Adrien
|
||||||
|
|
|
@ -288,11 +288,11 @@ public class SearchGroup<GROUP_VALUE_TYPE> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pull merged topN groups:
|
// Pull merged topN groups:
|
||||||
final List<SearchGroup<T>> newTopGroups = new ArrayList<>();
|
final List<SearchGroup<T>> newTopGroups = new ArrayList<>(topN);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
while(queue.size() != 0) {
|
while(!queue.isEmpty()) {
|
||||||
final MergedGroup<T> group = queue.pollFirst();
|
final MergedGroup<T> group = queue.pollFirst();
|
||||||
group.processed = true;
|
group.processed = true;
|
||||||
//System.out.println(" pop: shards=" + group.shards + " group=" + (group.groupValue == null ? "null" : (((BytesRef) group.groupValue).utf8ToString())) + " sortValues=" + Arrays.toString(group.topValues));
|
//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;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return newTopGroups;
|
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)
|
public static <T> Collection<SearchGroup<T>> merge(List<Collection<SearchGroup<T>>> topGroups, int offset, int topN, Sort groupSort)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (topGroups.size() == 0) {
|
if (topGroups.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return new GroupMerger<T>(groupSort).merge(topGroups, offset, topN);
|
return new GroupMerger<T>(groupSort).merge(topGroups, offset, topN);
|
||||||
|
|
Loading…
Reference in New Issue