Skip to content
Browse files

LUCENE-3468: Replaced last() and remove() with pollLast() in FirstPas…

…sGroupingCollector

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1177008 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 2e71c97 commit 3799f15ced86edd97c04ef639f0fcd86e75eef84 @mvgsoftware mvgsoftware committed Sep 28, 2011
View
11 modules/grouping/CHANGES.txt
@@ -0,0 +1,11 @@
+Grouping Module Change Log
+
+For more information on past and future Lucene versions, please see:
+http://s.apache.org/luceneversions
+
+======================= Trunk (not yet released) =======================
+
+Optimizations
+
+LUCENE-3468: Replaced last() and remove() with pollLast() in
+ FirstPassGroupingCollector (Martijn van Groningen)
View
12 ...ouping/src/java/org/apache/lucene/search/grouping/AbstractFirstPassGroupingCollector.java
@@ -213,9 +213,7 @@ public void collect(int doc) throws IOException {
// We already tested that the document is competitive, so replace
// the bottom group with this new group.
-
- // java 6-only: final CollectedSearchGroup bottomGroup = orderedGroups.pollLast();
- final CollectedSearchGroup<GROUP_VALUE_TYPE> bottomGroup = pollLast();
+ final CollectedSearchGroup<GROUP_VALUE_TYPE> bottomGroup = orderedGroups.pollLast();
assert orderedGroups.size() == topNGroups -1;
groupMap.remove(bottomGroup.groupValue);
@@ -351,13 +349,5 @@ public void setNextReader(AtomicReaderContext readerContext) throws IOException
*/
protected abstract GROUP_VALUE_TYPE copyDocGroupValue(GROUP_VALUE_TYPE groupValue, GROUP_VALUE_TYPE reuse);
-
-
- protected CollectedSearchGroup<GROUP_VALUE_TYPE> pollLast() {
- // java 6-only: final CollectedSearchGroup bottomGroup = orderedGroups.pollLast();
- final CollectedSearchGroup<GROUP_VALUE_TYPE> bottomGroup = orderedGroups.last();
- orderedGroups.remove(bottomGroup);
- return bottomGroup;
- }
}
View
18 solr/core/src/java/org/apache/solr/search/Grouping.java
@@ -666,7 +666,7 @@ protected Collector createFirstPassCollector() throws IOException {
}
sort = sort == null ? Sort.RELEVANCE : sort;
- firstPass = new TermFirstPassGroupingCollectorJava6(groupBy, sort, actualGroupsToFind);
+ firstPass = new TermFirstPassGroupingCollector(groupBy, sort, actualGroupsToFind);
return firstPass;
}
@@ -1013,22 +1013,6 @@ public void setNextReader(AtomicReaderContext readerContext) throws IOException
filler = docValues.getValueFiller();
mval = filler.getValue();
}
-
- @Override
- protected CollectedSearchGroup<MutableValue> pollLast() {
- return orderedGroups.pollLast();
- }
- }
-
- static class TermFirstPassGroupingCollectorJava6 extends TermFirstPassGroupingCollector {
- public TermFirstPassGroupingCollectorJava6(String groupField, Sort groupSort, int topNGroups) throws IOException {
- super(groupField, groupSort, topNGroups);
- }
-
- @Override
- protected CollectedSearchGroup<BytesRef> pollLast() {
- return orderedGroups.pollLast();
- }
}
static class FunctionSecondPassGroupingCollector extends AbstractSecondPassGroupingCollector<MutableValue> {

0 comments on commit 3799f15

Please sign in to comment.
Something went wrong with that request. Please try again.