lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpou...@apache.org
Subject svn commit: r1652034 [1/3] - in /lucene/dev/branches/lucene_solr_5_0: ./ lucene/ lucene/benchmark/ lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ lucene/core/ lucene/core/src/java/org/apache/lucene/search/ lucene/core/src/test/org/...
Date Thu, 15 Jan 2015 10:19:30 GMT
Author: jpountz
Date: Thu Jan 15 10:19:28 2015
New Revision: 1652034

URL: http://svn.apache.org/r1652034
Log:
LUCENE-6179: Disallow out-of-order scoring.

Added:
    lucene/dev/branches/lucene_solr_5_0/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinIndexSearcher.java
      - copied unchanged from r1652027, lucene/dev/branches/branch_5x/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinIndexSearcher.java
    lucene/dev/branches/lucene_solr_5_0/lucene/test-framework/src/java/org/apache/lucene/search/AssertingLeafCollector.java
      - copied unchanged from r1652027, lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/search/AssertingLeafCollector.java
Removed:
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestBooleanUnevenly.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestTopScoreDocCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/test-framework/src/java/org/apache/lucene/search/AssertingBulkOutOfOrderScorer.java
    lucene/dev/branches/lucene_solr_5_0/lucene/test-framework/src/java/org/apache/lucene/search/AssertingCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/test-framework/src/java/org/apache/lucene/search/RandomOrderCollector.java
Modified:
    lucene/dev/branches/lucene_solr_5_0/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/MIGRATE.txt   (contents, props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/benchmark/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java
    lucene/dev/branches/lucene_solr_5_0/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchWithCollectorTask.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/FilterLeafCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/FilteredQuery.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/LeafCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/MultiCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/SimpleCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/SortRescorer.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TopScoreDocCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TotalHitCountCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/Weight.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/package.html
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/MultiCollectorTest.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestBoolean2.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestBooleanCoord.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestBooleanOr.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestBooleanQuery.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestBooleanQueryVisitSubscorers.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestBooleanScorer.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestCachingCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestConstantScoreQuery.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestDocBoost.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestEarlyTermination.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestElevationComparator.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestScorerPerf.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestSimilarity.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestTermScorer.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestTopDocsCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestTopDocsMerge.java
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestTopFieldCollector.java   (contents, props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/facet/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/facet/src/java/org/apache/lucene/facet/DrillSideways.java
    lucene/dev/branches/lucene_solr_5_0/lucene/facet/src/java/org/apache/lucene/facet/DrillSidewaysQuery.java
    lucene/dev/branches/lucene_solr_5_0/lucene/facet/src/java/org/apache/lucene/facet/FacetsCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/facet/src/test/org/apache/lucene/facet/AssertingSubDocsAtOnceCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/facet/src/test/org/apache/lucene/facet/TestDrillSideways.java
    lucene/dev/branches/lucene_solr_5_0/lucene/grouping/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/grouping/src/java/org/apache/lucene/search/grouping/AbstractAllGroupHeadsCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/grouping/src/java/org/apache/lucene/search/grouping/AbstractAllGroupsCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/grouping/src/java/org/apache/lucene/search/grouping/AbstractDistinctValuesCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/grouping/src/java/org/apache/lucene/search/grouping/AbstractFirstPassGroupingCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/grouping/src/java/org/apache/lucene/search/grouping/AbstractGroupFacetCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/grouping/src/java/org/apache/lucene/search/grouping/AbstractSecondPassGroupingCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/grouping/src/java/org/apache/lucene/search/grouping/BlockGroupingCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java
    lucene/dev/branches/lucene_solr_5_0/lucene/highlighter/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java
    lucene/dev/branches/lucene_solr_5_0/lucene/join/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/join/src/java/org/apache/lucene/search/join/TermsCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/join/src/java/org/apache/lucene/search/join/TermsIncludingScoreQuery.java
    lucene/dev/branches/lucene_solr_5_0/lucene/join/src/java/org/apache/lucene/search/join/TermsWithScoreCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/join/src/java/org/apache/lucene/search/join/ToChildBlockJoinQuery.java
    lucene/dev/branches/lucene_solr_5_0/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java
    lucene/dev/branches/lucene_solr_5_0/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java
    lucene/dev/branches/lucene_solr_5_0/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java
    lucene/dev/branches/lucene_solr_5_0/lucene/memory/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
    lucene/dev/branches/lucene_solr_5_0/lucene/misc/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/misc/src/java/org/apache/lucene/search/EarlyTerminatingSortingCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/misc/src/test/org/apache/lucene/search/TestEarlyTerminatingSortingCollector.java
    lucene/dev/branches/lucene_solr_5_0/lucene/queries/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/queries/src/java/org/apache/lucene/queries/CustomScoreQuery.java
    lucene/dev/branches/lucene_solr_5_0/lucene/queryparser/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/queryparser/src/test/org/apache/lucene/queryparser/surround/query/BooleanQueryTst.java
    lucene/dev/branches/lucene_solr_5_0/lucene/sandbox/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/sandbox/src/test/org/apache/lucene/search/TestTermAutomatonQuery.java
    lucene/dev/branches/lucene_solr_5_0/lucene/suggest/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggester.java
    lucene/dev/branches/lucene_solr_5_0/lucene/test-framework/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/test-framework/src/java/org/apache/lucene/search/AssertingBulkScorer.java
    lucene/dev/branches/lucene_solr_5_0/lucene/test-framework/src/java/org/apache/lucene/search/AssertingWeight.java
    lucene/dev/branches/lucene_solr_5_0/lucene/test-framework/src/java/org/apache/lucene/search/CheckHits.java
    lucene/dev/branches/lucene_solr_5_0/lucene/test-framework/src/java/org/apache/lucene/search/QueryUtils.java
    lucene/dev/branches/lucene_solr_5_0/solr/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/solr/contrib/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/solr/contrib/analytics/src/java/org/apache/solr/analytics/accumulator/ValueAccumulator.java
    lucene/dev/branches/lucene_solr_5_0/solr/core/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/solr/core/src/java/org/apache/solr/handler/component/ExpandComponent.java
    lucene/dev/branches/lucene_solr_5_0/solr/core/src/java/org/apache/solr/search/CollapsingQParserPlugin.java
    lucene/dev/branches/lucene_solr_5_0/solr/core/src/java/org/apache/solr/search/DelegatingCollector.java
    lucene/dev/branches/lucene_solr_5_0/solr/core/src/java/org/apache/solr/search/DocSetCollector.java
    lucene/dev/branches/lucene_solr_5_0/solr/core/src/java/org/apache/solr/search/EarlyTerminatingCollector.java
    lucene/dev/branches/lucene_solr_5_0/solr/core/src/java/org/apache/solr/search/ExportQParserPlugin.java
    lucene/dev/branches/lucene_solr_5_0/solr/core/src/java/org/apache/solr/search/Grouping.java
    lucene/dev/branches/lucene_solr_5_0/solr/core/src/java/org/apache/solr/search/ReRankQParserPlugin.java
    lucene/dev/branches/lucene_solr_5_0/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
    lucene/dev/branches/lucene_solr_5_0/solr/core/src/java/org/apache/solr/search/grouping/distributed/command/QueryCommand.java
    lucene/dev/branches/lucene_solr_5_0/solr/core/src/test/org/apache/solr/search/TestRankQueryPlugin.java
    lucene/dev/branches/lucene_solr_5_0/solr/core/src/test/org/apache/solr/search/TestSort.java

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/CHANGES.txt?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/CHANGES.txt Thu Jan 15 10:19:28 2015
@@ -332,6 +332,10 @@ API Changes
 * LUCENE-6158, LUCENE-6165: IndexWriter.addIndexes(IndexReader...) changed to
   addIndexes(CodecReader...) (Robert Muir)
 
+* LUCENE-6179: Out-of-order scoring is not allowed anymore, so
+  Weight.scoresDocsOutOfOrder and LeafCollector.acceptsDocsOutOfOrder have been
+  removed and boolean queries now always score in order.
+
 Bug Fixes
 
 * LUCENE-5650: Enforce read-only access to any path outside the temporary

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/MIGRATE.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/MIGRATE.txt?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/MIGRATE.txt (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/MIGRATE.txt Thu Jan 15 10:19:28 2015
@@ -87,3 +87,9 @@ their ValueSources in a "DefFunction" al
 PayloadAttributeImpl.clone() did a shallow clone which was incorrect, and was
 fixed to do a deep clone. If you require shallow cloning of the underlying bytes,
 you should override PayloadAttributeImpl.clone() to do a shallow clone instead.
+
+## Removed out-of-order scoring (LUCENE-6179)
+
+Bulk scorers must now always collect documents in order. If you have custom
+collectors, the acceptsDocsOutOfOrder method has been removed and collectors
+can safely assume that they will be collected in order.

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java Thu Jan 15 10:19:28 2015
@@ -122,8 +122,7 @@ public abstract class ReadTask extends P
             // pulling the Weight ourselves:
             TopFieldCollector collector = TopFieldCollector.create(sort, numHits,
                                                                    true, withScore(),
-                                                                   withMaxScore(),
-                                                                   false);
+                                                                   withMaxScore());
             searcher.search(q, null, collector);
             hits = collector.topDocs();
           } else {
@@ -189,7 +188,7 @@ public abstract class ReadTask extends P
   }
 
   protected Collector createCollector() throws Exception {
-    return TopScoreDocCollector.create(numHits(), true);
+    return TopScoreDocCollector.create(numHits());
   }
 
 

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchWithCollectorTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchWithCollectorTask.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchWithCollectorTask.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchWithCollectorTask.java Thu Jan 15 10:19:28 2015
@@ -52,10 +52,8 @@ public class SearchWithCollectorTask ext
   @Override
   protected Collector createCollector() throws Exception {
     Collector collector = null;
-    if (clnName.equalsIgnoreCase("topScoreDocOrdered") == true) {
-      collector = TopScoreDocCollector.create(numHits(), true);
-    } else if (clnName.equalsIgnoreCase("topScoreDocUnOrdered") == true) {
-      collector = TopScoreDocCollector.create(numHits(), false);
+    if (clnName.equalsIgnoreCase("topScoreDoc") == true) {
+      collector = TopScoreDocCollector.create(numHits());
     } else if (clnName.length() > 0){
       collector = Class.forName(clnName).asSubclass(Collector.class).newInstance();
 

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java Thu Jan 15 10:19:28 2015
@@ -24,8 +24,8 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.LeafReaderContext;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.BooleanClause.Occur;
 import org.apache.lucene.search.similarities.Similarity;
@@ -305,21 +305,19 @@ public class BooleanQuery extends Query
     }
 
     @Override
-    public BulkScorer bulkScorer(LeafReaderContext context, boolean scoreDocsInOrder,
-                                 Bits acceptDocs) throws IOException {
+    public BulkScorer bulkScorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
 
-      if (scoreDocsInOrder || minNrShouldMatch > 1) {
+      if (minNrShouldMatch > 1) {
         // TODO: (LUCENE-4872) in some cases BooleanScorer may be faster for minNrShouldMatch
         // but the same is even true of pure conjunctions...
-        return super.bulkScorer(context, scoreDocsInOrder, acceptDocs);
+        return super.bulkScorer(context, acceptDocs);
       }
 
-      List<BulkScorer> prohibited = new ArrayList<BulkScorer>();
       List<BulkScorer> optional = new ArrayList<BulkScorer>();
       Iterator<BooleanClause> cIter = clauses.iterator();
       for (Weight w  : weights) {
         BooleanClause c =  cIter.next();
-        BulkScorer subScorer = w.bulkScorer(context, false, acceptDocs);
+        BulkScorer subScorer = w.bulkScorer(context, acceptDocs);
         if (subScorer == null) {
           if (c.isRequired()) {
             return null;
@@ -328,16 +326,20 @@ public class BooleanQuery extends Query
           // TODO: there are some cases where BooleanScorer
           // would handle conjunctions faster than
           // BooleanScorer2...
-          return super.bulkScorer(context, scoreDocsInOrder, acceptDocs);
+          return super.bulkScorer(context, acceptDocs);
         } else if (c.isProhibited()) {
           // TODO: there are some cases where BooleanScorer could do this faster
-          return super.bulkScorer(context, scoreDocsInOrder, acceptDocs);
+          return super.bulkScorer(context, acceptDocs);
         } else {
           optional.add(subScorer);
         }
       }
 
-      return new BooleanScorer(this, disableCoord, minNrShouldMatch, optional, prohibited, maxCoord);
+      if (optional.size() == 0) {
+        return null;
+      }
+
+      return new BooleanScorer(this, disableCoord, maxCoord, optional);
     }
 
     @Override
@@ -432,30 +434,6 @@ public class BooleanQuery extends Query
       }
     }
     
-    @Override
-    public boolean scoresDocsOutOfOrder() {
-      if (minNrShouldMatch > 1) {
-        // BS2 (in-order) will be used by scorer()
-        return false;
-      }
-      int optionalCount = 0;
-      for (BooleanClause c : clauses) {
-        if (c.isRequired()) {
-          // BS2 (in-order) will be used by scorer()
-          return false;
-        } else if (!c.isProhibited()) {
-          optionalCount++;
-        }
-      }
-      
-      if (optionalCount == minNrShouldMatch) {
-        return false; // BS2 (in-order) will be used, as this means conjunction
-      }
-      
-      // scorer() will return an out-of-order scorer if requested.
-      return true;
-    }
-    
     private Scorer req(List<Scorer> required, boolean disableCoord) {
       if (required.size() == 1) {
         Scorer req = required.get(0);

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/BooleanScorer.java Thu Jan 15 10:19:28 2015
@@ -18,255 +18,129 @@ package org.apache.lucene.search;
  */
 
 import java.io.IOException;
-import java.util.List;
+import java.util.Arrays;
+import java.util.Collection;
 
 import org.apache.lucene.search.BooleanQuery.BooleanWeight;
 
-/* Description from Doug Cutting (excerpted from
- * LUCENE-1483):
- *
- * BooleanScorer uses an array to score windows of
- * 2K docs. So it scores docs 0-2K first, then docs 2K-4K,
- * etc. For each window it iterates through all query terms
- * and accumulates a score in table[doc%2K]. It also stores
- * in the table a bitmask representing which terms
- * contributed to the score. Non-zero scores are chained in
- * a linked list. At the end of scoring each window it then
- * iterates through the linked list and, if the bitmask
- * matches the boolean constraints, collects a hit. For
- * boolean queries with lots of frequent terms this can be
- * much faster, since it does not need to update a priority
- * queue for each posting, instead performing constant-time
- * operations per posting. The only downside is that it
- * results in hits being delivered out-of-order within the
- * window, which means it cannot be nested within other
- * scorers. But it works well as a top-level scorer.
- *
- * The new BooleanScorer2 implementation instead works by
- * merging priority queues of postings, albeit with some
- * clever tricks. For example, a pure conjunction (all terms
- * required) does not require a priority queue. Instead it
- * sorts the posting streams at the start, then repeatedly
- * skips the first to to the last. If the first ever equals
- * the last, then there's a hit. When some terms are
- * required and some terms are optional, the conjunction can
- * be evaluated first, then the optional terms can all skip
- * to the match and be added to the score. Thus the
- * conjunction can reduce the number of priority queue
- * updates for the optional terms. */
-
+/**
+ * BulkSorer that is used for pure disjunctions: no MUST clauses and
+ * minShouldMatch == 1. This scorer scores documents by batches of 2048 docs.
+ */
 final class BooleanScorer extends BulkScorer {
-  
-  private static final class BooleanScorerCollector extends SimpleCollector {
-    private BucketTable bucketTable;
-    private int mask;
-    private Scorer scorer;
-    
-    public BooleanScorerCollector(int mask, BucketTable bucketTable) {
-      this.mask = mask;
-      this.bucketTable = bucketTable;
-    }
-    
-    @Override
-    public void collect(final int doc) throws IOException {
-      final BucketTable table = bucketTable;
-      final int i = doc & BucketTable.MASK;
-      final Bucket bucket = table.buckets[i];
-      
-      if (bucket.doc != doc) {                    // invalid bucket
-        bucket.doc = doc;                         // set doc
-        bucket.score = scorer.score();            // initialize score
-        bucket.bits = mask;                       // initialize mask
-        bucket.coord = 1;                         // initialize coord
-
-        bucket.next = table.first;                // push onto valid list
-        table.first = bucket;
-      } else {                                    // valid bucket
-        bucket.score += scorer.score();           // increment score
-        bucket.bits |= mask;                      // add bits in mask
-        bucket.coord++;                           // increment coord
-      }
-    }
-    
+
+  static final int SHIFT = 11;
+  static final int SIZE = 1 << SHIFT;
+  static final int MASK = SIZE - 1;
+  static final int SET_SIZE = 1 << (SHIFT - 6);
+  static final int SET_MASK = SET_SIZE - 1;
+
+  static class Bucket {
+    double score;
+    int freq;
+  }
+
+  final Bucket[] buckets = new Bucket[SIZE];
+  // This is basically an inlined FixedBitSet... seems to help with bound checks
+  final long[] matching = new long[SET_SIZE];
+
+  final float[] coordFactors;
+  final BulkScorer[] optionalScorers;
+  final FakeScorer fakeScorer = new FakeScorer();
+
+  boolean hasMatches;
+  int max = 0;
+
+  final class OrCollector implements LeafCollector {
+    Scorer scorer;
+
     @Override
     public void setScorer(Scorer scorer) {
       this.scorer = scorer;
     }
-    
+
     @Override
-    public boolean acceptsDocsOutOfOrder() {
-      return true;
+    public void collect(int doc) throws IOException {
+      hasMatches = true;
+      final int i = doc & MASK;
+      final int idx = i >>> 6;
+      matching[idx] |= 1L << i;
+      final Bucket bucket = buckets[i];
+      bucket.freq++;
+      bucket.score += scorer.score();
     }
-
   }
-  
-  static final class Bucket {
-    int doc = -1;            // tells if bucket is valid
-    double score;             // incremental score
-    // TODO: break out bool anyProhibited, int
-    // numRequiredMatched; then we can remove 32 limit on
-    // required clauses
-    int bits;                // used for bool constraints
-    int coord;               // count of terms in score
-    Bucket next;             // next valid bucket
-  }
-  
-  /** A simple hash table of document scores within a range. */
-  static final class BucketTable {
-    public static final int SIZE = 1 << 11;
-    public static final int MASK = SIZE - 1;
-
-    final Bucket[] buckets = new Bucket[SIZE];
-    Bucket first = null;                          // head of valid list
-  
-    public BucketTable() {
-      // Pre-fill to save the lazy init when collecting
-      // each sub:
-      for(int idx=0;idx<SIZE;idx++) {
-        buckets[idx] = new Bucket();
-      }
+
+  final OrCollector orCollector = new OrCollector();
+
+  BooleanScorer(BooleanWeight weight, boolean disableCoord, int maxCoord, Collection<BulkScorer> optionalScorers) {
+    for (int i = 0; i < buckets.length; i++) {
+      buckets[i] = new Bucket();
     }
+    this.optionalScorers = optionalScorers.toArray(new BulkScorer[0]);
 
-    public LeafCollector newCollector(int mask) {
-      return new BooleanScorerCollector(mask, this);
+    coordFactors = new float[optionalScorers.size() + 1];
+    for (int i = 0; i < coordFactors.length; i++) {
+      coordFactors[i] = disableCoord ? 1.0f : weight.coord(i, maxCoord);
     }
+  }
 
-    public int size() { return SIZE; }
+  private void scoreDocument(LeafCollector collector, int base, int i) throws IOException {
+    final Bucket bucket = buckets[i];
+    fakeScorer.freq = bucket.freq;
+    fakeScorer.score = (float) bucket.score * coordFactors[bucket.freq];
+    final int doc = base | i;
+    fakeScorer.doc = doc;
+    collector.collect(doc);
+    bucket.freq = 0;
+    bucket.score = 0;
   }
 
-  static final class SubScorer {
-    public BulkScorer scorer;
-    // TODO: re-enable this if BQ ever sends us required clauses
-    //public boolean required = false;
-    public boolean prohibited;
-    public LeafCollector collector;
-    public SubScorer next;
-    public boolean more;
-
-    public SubScorer(BulkScorer scorer, boolean required, boolean prohibited,
-        LeafCollector collector, SubScorer next) {
-      if (required) {
-        throw new IllegalArgumentException("this scorer cannot handle required=true");
+  private void scoreMatches(LeafCollector collector, int base) throws IOException {
+    long matching[] = this.matching;
+    for (int idx = 0; idx < matching.length; idx++) {
+      long bits = matching[idx];
+      while (bits != 0L) {
+        int ntz = Long.numberOfTrailingZeros(bits);
+        int doc = idx << 6 | ntz;
+        scoreDocument(collector, base, doc);
+        bits ^= 1L << ntz;
       }
-      this.scorer = scorer;
-      this.more = true;
-      // TODO: re-enable this if BQ ever sends us required clauses
-      //this.required = required;
-      this.prohibited = prohibited;
-      this.collector = collector;
-      this.next = next;
-    }
-  }
-  
-  private SubScorer scorers = null;
-  private BucketTable bucketTable = new BucketTable();
-  private final float[] coordFactors;
-  // TODO: re-enable this if BQ ever sends us required clauses
-  //private int requiredMask = 0;
-  private final int minNrShouldMatch;
-  private int end;
-  private Bucket current;
-  // Any time a prohibited clause matches we set bit 0:
-  private static final int PROHIBITED_MASK = 1;
-
-  private final Weight weight;
-
-  BooleanScorer(BooleanWeight weight, boolean disableCoord, int minNrShouldMatch,
-      List<BulkScorer> optionalScorers, List<BulkScorer> prohibitedScorers, int maxCoord) throws IOException {
-    this.minNrShouldMatch = minNrShouldMatch;
-    this.weight = weight;
+    }
+  }
 
+  private boolean collectMatches() throws IOException {
+    boolean more = false;
     for (BulkScorer scorer : optionalScorers) {
-      scorers = new SubScorer(scorer, false, false, bucketTable.newCollector(0), scorers);
-    }
-    
-    for (BulkScorer scorer : prohibitedScorers) {
-      scorers = new SubScorer(scorer, false, true, bucketTable.newCollector(PROHIBITED_MASK), scorers);
+      more |= scorer.score(orCollector, max);
     }
+    return more;
+  }
 
-    coordFactors = new float[optionalScorers.size() + 1];
-    for (int i = 0; i < coordFactors.length; i++) {
-      coordFactors[i] = disableCoord ? 1.0f : weight.coord(i, maxCoord); 
+  private boolean scoreWindow(LeafCollector collector, int base, int max) throws IOException {
+    this.max = Math.min(base + SIZE, max);
+    hasMatches = false;
+    boolean more = collectMatches();
+
+    if (hasMatches) {
+      scoreMatches(collector, base);
+      Arrays.fill(matching, 0L);
     }
+
+    return more;
   }
 
   @Override
   public boolean score(LeafCollector collector, int max) throws IOException {
+    fakeScorer.doc = -1;
+    collector.setScorer(fakeScorer);
 
-    boolean more;
-    Bucket tmp;
-    FakeScorer fs = new FakeScorer();
-
-    // The internal loop will set the score and doc before calling collect.
-    collector.setScorer(fs);
-    do {
-      bucketTable.first = null;
-      
-      while (current != null) {         // more queued 
-
-        // check prohibited & required
-        if ((current.bits & PROHIBITED_MASK) == 0) {
-
-          // TODO: re-enable this if BQ ever sends us required
-          // clauses
-          //&& (current.bits & requiredMask) == requiredMask) {
-          
-          // NOTE: Lucene always passes max =
-          // Integer.MAX_VALUE today, because we never embed
-          // a BooleanScorer inside another (even though
-          // that should work)... but in theory an outside
-          // app could pass a different max so we must check
-          // it:
-          if (current.doc >= max) {
-            tmp = current;
-            current = current.next;
-            tmp.next = bucketTable.first;
-            bucketTable.first = tmp;
-            continue;
-          }
-          
-          if (current.coord >= minNrShouldMatch) {
-            fs.score = (float) (current.score * coordFactors[current.coord]);
-            fs.doc = current.doc;
-            fs.freq = current.coord;
-            collector.collect(current.doc);
-          }
-        }
-        
-        current = current.next;         // pop the queue
+    for (int docBase = this.max & ~MASK; docBase < max; docBase += SIZE) {
+      if (scoreWindow(collector, docBase, max) == false) {
+        return false;
       }
-      
-      if (bucketTable.first != null){
-        current = bucketTable.first;
-        bucketTable.first = current.next;
-        return true;
-      }
-
-      // refill the queue
-      more = false;
-      end += BucketTable.SIZE;
-      for (SubScorer sub = scorers; sub != null; sub = sub.next) {
-        if (sub.more) {
-          sub.more = sub.scorer.score(sub.collector, end);
-          more |= sub.more;
-        }
-      }
-      current = bucketTable.first;
-      
-    } while (current != null || more);
-
-    return false;
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder buffer = new StringBuilder();
-    buffer.append("boolean(");
-    for (SubScorer sub = scorers; sub != null; sub = sub.next) {
-      buffer.append(sub.scorer.toString());
-      buffer.append(" ");
     }
-    buffer.append(")");
-    return buffer.toString();
+
+    return true;
   }
 }

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/CachingCollector.java Thu Jan 15 10:19:28 2015
@@ -82,7 +82,6 @@ public abstract class CachingCollector e
 
   private static class NoScoreCachingCollector extends CachingCollector {
 
-    List<Boolean> acceptDocsOutOfOrders;
     List<LeafReaderContext> contexts;
     List<int[]> docs;
     int maxDocsToCache;
@@ -92,7 +91,6 @@ public abstract class CachingCollector e
       super(in);
       this.maxDocsToCache = maxDocsToCache;
       contexts = new ArrayList<>();
-      acceptDocsOutOfOrders = new ArrayList<>();
       docs = new ArrayList<>();
     }
 
@@ -105,7 +103,6 @@ public abstract class CachingCollector e
       final LeafCollector in = this.in.getLeafCollector(context);
       if (contexts != null) {
         contexts.add(context);
-        acceptDocsOutOfOrders.add(in.acceptsDocsOutOfOrder());
       }
       if (maxDocsToCache >= 0) {
         return lastCollector = wrap(in, maxDocsToCache);
@@ -152,14 +149,7 @@ public abstract class CachingCollector e
       assert docs.size() == contexts.size();
       for (int i = 0; i < contexts.size(); ++i) {
         final LeafReaderContext context = contexts.get(i);
-        final boolean docsInOrder = !acceptDocsOutOfOrders.get(i);
         final LeafCollector collector = other.getLeafCollector(context);
-        if (!collector.acceptsDocsOutOfOrder() && !docsInOrder) {
-          throw new IllegalArgumentException(
-                "cannot replay: given collector does not support "
-                    + "out-of-order collection, while the wrapped collector does. "
-                    + "Therefore cached documents may be out-of-order.");
-        }
         collect(collector, i);
       }
     }
@@ -300,16 +290,9 @@ public abstract class CachingCollector e
    * Creates a {@link CachingCollector} which does not wrap another collector.
    * The cached documents and scores can later be {@link #replay(Collector)
    * replayed}.
-   *
-   * @param acceptDocsOutOfOrder
-   *          whether documents are allowed to be collected out-of-order
    */
-  public static CachingCollector create(final boolean acceptDocsOutOfOrder, boolean cacheScores, double maxRAMMB) {
+  public static CachingCollector create(boolean cacheScores, double maxRAMMB) {
     Collector other = new SimpleCollector() {
-      @Override
-      public boolean acceptsDocsOutOfOrder() {
-        return acceptDocsOutOfOrder;
-      }
 
       @Override
       public void collect(int doc) {}

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java Thu Jan 15 10:19:28 2015
@@ -134,14 +134,14 @@ public class ConstantScoreQuery extends
     }
 
     @Override
-    public BulkScorer bulkScorer(LeafReaderContext context, boolean scoreDocsInOrder, Bits acceptDocs) throws IOException {
+    public BulkScorer bulkScorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
       final DocIdSetIterator disi;
       if (filter != null) {
         assert query == null;
-        return super.bulkScorer(context, scoreDocsInOrder, acceptDocs);
+        return super.bulkScorer(context, acceptDocs);
       } else {
         assert query != null && innerWeight != null;
-        BulkScorer bulkScorer = innerWeight.bulkScorer(context, scoreDocsInOrder, acceptDocs);
+        BulkScorer bulkScorer = innerWeight.bulkScorer(context, acceptDocs);
         if (bulkScorer == null) {
           return null;
         }
@@ -171,11 +171,6 @@ public class ConstantScoreQuery extends
     }
 
     @Override
-    public boolean scoresDocsOutOfOrder() {
-      return (innerWeight != null) ? innerWeight.scoresDocsOutOfOrder() : false;
-    }
-
-    @Override
     public Explanation explain(LeafReaderContext context, int doc) throws IOException {
       final Scorer cs = scorer(context, context.reader().getLiveDocs());
       final boolean exists = (cs != null && cs.advance(doc) == doc);

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/FilterLeafCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/FilterLeafCollector.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/FilterLeafCollector.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/FilterLeafCollector.java Thu Jan 15 10:19:28 2015
@@ -44,11 +44,6 @@ public class FilterLeafCollector impleme
   }
 
   @Override
-  public boolean acceptsDocsOutOfOrder() {
-    return in.acceptsDocsOutOfOrder();
-  }
-
-  @Override
   public String toString() {
     return getClass().getSimpleName() + "(" + in + ")";
   }

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/FilteredQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/FilteredQuery.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/FilteredQuery.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/FilteredQuery.java Thu Jan 15 10:19:28 2015
@@ -81,11 +81,6 @@ public class FilteredQuery extends Query
   public Weight createWeight(final IndexSearcher searcher) throws IOException {
     final Weight weight = query.createWeight (searcher);
     return new Weight() {
-      
-      @Override
-      public boolean scoresDocsOutOfOrder() {
-        return true;
-      }
 
       @Override
       public float getValueForNormalization() throws IOException { 
@@ -138,7 +133,7 @@ public class FilteredQuery extends Query
 
       // return a filtering top scorer
       @Override
-      public BulkScorer bulkScorer(LeafReaderContext context, boolean scoreDocsInOrder, Bits acceptDocs) throws IOException {
+      public BulkScorer bulkScorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
         assert filter != null;
 
         DocIdSet filterDocIdSet = filter.getDocIdSet(context, acceptDocs);
@@ -147,7 +142,7 @@ public class FilteredQuery extends Query
           return null;
         }
 
-        return strategy.filteredBulkScorer(context, weight, scoreDocsInOrder, filterDocIdSet);
+        return strategy.filteredBulkScorer(context, weight, filterDocIdSet);
       }
     };
   }
@@ -480,7 +475,7 @@ public class FilteredQuery extends Query
      * @return a filtered top scorer
      */
     public BulkScorer filteredBulkScorer(LeafReaderContext context,
-        Weight weight, boolean scoreDocsInOrder, DocIdSet docIdSet) throws IOException {
+        Weight weight, DocIdSet docIdSet) throws IOException {
       Scorer scorer = filteredScorer(context, weight, docIdSet);
       if (scorer == null) {
         return null;
@@ -603,13 +598,12 @@ public class FilteredQuery extends Query
     @Override
     public BulkScorer filteredBulkScorer(final LeafReaderContext context,
         Weight weight,
-        boolean scoreDocsInOrder, // ignored (we always top-score in order)
         DocIdSet docIdSet) throws IOException {
       Bits filterAcceptDocs = docIdSet.bits();
       if (filterAcceptDocs == null) {
         // Filter does not provide random-access Bits; we
         // must fallback to leapfrog:
-        return LEAP_FROG_QUERY_FIRST_STRATEGY.filteredBulkScorer(context, weight, scoreDocsInOrder, docIdSet);
+        return LEAP_FROG_QUERY_FIRST_STRATEGY.filteredBulkScorer(context, weight, docIdSet);
       }
       final Scorer scorer = weight.scorer(context, null);
       return scorer == null ? null : new QueryFirstBulkScorer(scorer, filterAcceptDocs);

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java Thu Jan 15 10:19:28 2015
@@ -479,7 +479,7 @@ public class IndexSearcher {
       limit = 1;
     }
     nDocs = Math.min(nDocs, limit);
-    TopScoreDocCollector collector = TopScoreDocCollector.create(nDocs, after, !weight.scoresDocsOutOfOrder());
+    TopScoreDocCollector collector = TopScoreDocCollector.create(nDocs, after);
     search(leaves, weight, collector);
     return collector.topDocs();
   }
@@ -528,8 +528,7 @@ public class IndexSearcher {
                                                                       after,
                                                                       fillFields,
                                                                       doDocScores,
-                                                                      doMaxScore,
-                                                                      false);
+                                                                      doMaxScore);
 
       final Lock lock = new ReentrantLock();
       final ExecutionHelper<TopFieldDocs> runner = new ExecutionHelper<>(executor);
@@ -569,7 +568,7 @@ public class IndexSearcher {
 
     TopFieldCollector collector = TopFieldCollector.create(sort, nDocs, after,
                                                            fillFields, doDocScores,
-                                                           doMaxScore, !weight.scoresDocsOutOfOrder());
+                                                           doMaxScore);
     search(leaves, weight, collector);
     return (TopFieldDocs) collector.topDocs();
   }
@@ -608,7 +607,7 @@ public class IndexSearcher {
         // continue with the following leaf
         continue;
       }
-      BulkScorer scorer = weight.bulkScorer(ctx, !leafCollector.acceptsDocsOutOfOrder(), ctx.reader().getLiveDocs());
+      BulkScorer scorer = weight.bulkScorer(ctx, ctx.reader().getLiveDocs());
       if (scorer != null) {
         try {
           scorer.score(leafCollector);

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/LeafCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/LeafCollector.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/LeafCollector.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/LeafCollector.java Thu Jan 15 10:19:28 2015
@@ -56,14 +56,9 @@ import java.io.IOException;
  *         bits.set(docBase + doc);
  *       }
  *
- *       // accept docs out of order (for a BitSet it doesn't matter)
- *       public boolean acceptsDocsOutOfOrder() {
- *         return true;
- *       }
- *          
  *     };
  *   }
- *      
+ *
  * });
  * </pre>
  *
@@ -98,22 +93,4 @@ public interface LeafCollector {
    */
   void collect(int doc) throws IOException;
 
-  /**
-   * Return <code>true</code> if this collector does not
-   * require the matching docIDs to be delivered in int sort
-   * order (smallest to largest) to {@link #collect}.
-   *
-   * <p> Most Lucene Query implementations will visit
-   * matching docIDs in order.  However, some queries
-   * (currently limited to certain cases of {@link
-   * BooleanQuery}) can achieve faster searching if the
-   * <code>Collector</code> allows them to deliver the
-   * docIDs out of order.</p>
-   *
-   * <p> Many collectors don't mind getting docIDs out of
-   * order, so it's important to return <code>true</code>
-   * here.
-   */
-  boolean acceptsDocsOutOfOrder();
-
 }

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/MultiCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/MultiCollector.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/MultiCollector.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/MultiCollector.java Thu Jan 15 10:19:28 2015
@@ -124,16 +124,6 @@ public class MultiCollector implements C
       }
     }
 
-    @Override
-    public boolean acceptsDocsOutOfOrder() {
-      for (LeafCollector c : collectors) {
-        if (!c.acceptsDocsOutOfOrder()) {
-          return false;
-        }
-      }
-      return true;
-    }
-
   }
 
 }

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/SimpleCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/SimpleCollector.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/SimpleCollector.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/SimpleCollector.java Thu Jan 15 10:19:28 2015
@@ -45,9 +45,6 @@ public abstract class SimpleCollector im
   // redeclare methods so that javadocs are inherited on sub-classes
 
   @Override
-  public abstract boolean acceptsDocsOutOfOrder();
-
-  @Override
   public abstract void collect(int doc) throws IOException;
 
 }

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/SortRescorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/SortRescorer.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/SortRescorer.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/SortRescorer.java Thu Jan 15 10:19:28 2015
@@ -53,7 +53,7 @@ public class SortRescorer extends Rescor
 
     List<LeafReaderContext> leaves = searcher.getIndexReader().leaves();
 
-    TopFieldCollector collector = TopFieldCollector.create(sort, topN, true, true, true, false);
+    TopFieldCollector collector = TopFieldCollector.create(sort, topN, true, true, true);
 
     // Now merge sort docIDs from hits, with reader's leaves:
     int hitUpto = 0;

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java Thu Jan 15 10:19:28 2015
@@ -27,7 +27,7 @@ import org.apache.lucene.util.PriorityQu
  * A {@link Collector} that sorts by {@link SortField} using
  * {@link FieldComparator}s.
  * <p/>
- * See the {@link #create(org.apache.lucene.search.Sort, int, boolean, boolean, boolean, boolean)} method
+ * See the {@link #create(org.apache.lucene.search.Sort, int, boolean, boolean, boolean)} method
  * for instantiating a TopFieldCollector.
  *
  * @lucene.experimental
@@ -55,11 +55,6 @@ public abstract class TopFieldCollector
       this.scorer = scorer;
       comparator.setScorer(scorer);
     }
-
-    @Override
-    public boolean acceptsDocsOutOfOrder() {
-      return false;
-    }
   }
 
   private static abstract class MultiComparatorLeafCollector implements LeafCollector {
@@ -124,11 +119,6 @@ public abstract class TopFieldCollector
         comparator.setScorer(scorer);
       }
     }
-
-    @Override
-    public boolean acceptsDocsOutOfOrder() {
-      return false;
-    }
   }
 
   /*
@@ -219,102 +209,6 @@ public abstract class TopFieldCollector
   }
 
   /*
-   * Implements a TopFieldCollector over one SortField criteria, without
-   * tracking document scores and maxScore, and assumes out of orderness in doc
-   * Ids collection.
-   */
-  private static class OutOfOrderNonScoringCollector extends TopFieldCollector {
-
-    final FieldValueHitQueue<Entry> queue;
-
-    public OutOfOrderNonScoringCollector(FieldValueHitQueue<Entry> queue, int numHits, boolean fillFields) {
-      super(queue, numHits, fillFields);
-      this.queue = queue;
-    }
-
-    @Override
-    public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException {
-      docBase = context.docBase;
-
-      final LeafFieldComparator[] comparators = queue.getComparators(context);
-      final int[] reverseMul = queue.getReverseMul();
-
-      if (comparators.length == 1) {
-        return new OneComparatorLeafCollector(comparators[0], reverseMul[0]) {
-
-          @Override
-          public void collect(int doc) throws IOException {
-            ++totalHits;
-            if (queueFull) {
-              // Fastmatch: return if this hit is not competitive
-              final int cmp = reverseMul * comparator.compareBottom(doc);
-              if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.doc)) {
-                return;
-              }
-
-              // This hit is competitive - replace bottom element in queue & adjustTop
-              comparator.copy(bottom.slot, doc);
-              updateBottom(doc);
-              comparator.setBottom(bottom.slot);
-            } else {
-              // Startup transient: queue hasn't gathered numHits yet
-              final int slot = totalHits - 1;
-              // Copy hit into queue
-              comparator.copy(slot, doc);
-              add(slot, doc, Float.NaN);
-              if (queueFull) {
-                comparator.setBottom(bottom.slot);
-              }
-            }
-          }
-
-          @Override
-          public boolean acceptsDocsOutOfOrder() {
-            return true;
-          }
-
-        };
-      } else {
-        return new MultiComparatorLeafCollector(comparators, reverseMul) {
-
-          @Override
-          public void collect(int doc) throws IOException {
-            ++totalHits;
-            if (queueFull) {
-              // Fastmatch: return if this hit is not competitive
-              final int cmp = compareBottom(doc);
-              if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.doc)) {
-                return;
-              }
-
-              // This hit is competitive - replace bottom element in queue & adjustTop
-              copy(bottom.slot, doc);
-              updateBottom(doc);
-              setBottom(bottom.slot);
-            } else {
-              // Startup transient: queue hasn't gathered numHits yet
-              final int slot = totalHits - 1;
-              // Copy hit into queue
-              copy(slot, doc);
-              add(slot, doc, Float.NaN);
-              if (queueFull) {
-                setBottom(bottom.slot);
-              }
-            }
-          }
-
-          @Override
-          public boolean acceptsDocsOutOfOrder() {
-            return true;
-          }
-
-        };
-      }
-    }
-
-  }
-
-  /*
    * Implements a TopFieldCollector over one SortField criteria, while tracking
    * document scores but no maxScore.
    */
@@ -414,113 +308,6 @@ public abstract class TopFieldCollector
   }
 
   /*
-   * Implements a TopFieldCollector over one SortField criteria, while tracking
-   * document scores but no maxScore, and assumes out of orderness in doc Ids
-   * collection.
-   */
-  private static class OutOfOrderScoringNoMaxScoreCollector extends TopFieldCollector {
-
-    final FieldValueHitQueue<Entry> queue;
-
-    public OutOfOrderScoringNoMaxScoreCollector(FieldValueHitQueue<Entry> queue, int numHits, boolean fillFields) {
-      super(queue, numHits, fillFields);
-      this.queue = queue;
-    }
-
-    @Override
-    public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException {
-      docBase = context.docBase;
-
-      final LeafFieldComparator[] comparators = queue.getComparators(context);
-      final int[] reverseMul = queue.getReverseMul();
-
-      if (comparators.length == 1) {
-        return new OneComparatorLeafCollector(comparators[0], reverseMul[0]) {
-
-          @Override
-          public void collect(int doc) throws IOException {
-            ++totalHits;
-            if (queueFull) {
-              // Fastmatch: return if this hit is not competitive
-              final int cmp = reverseMul * comparator.compareBottom(doc);
-              if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.doc)) {
-                return;
-              }
-
-              // Compute the score only if the hit is competitive.
-              final float score = scorer.score();
-
-              // This hit is competitive - replace bottom element in queue & adjustTop
-              comparator.copy(bottom.slot, doc);
-              updateBottom(doc, score);
-              comparator.setBottom(bottom.slot);
-            } else {
-              // Compute the score only if the hit is competitive.
-              final float score = scorer.score();
-
-              // Startup transient: queue hasn't gathered numHits yet
-              final int slot = totalHits - 1;
-              // Copy hit into queue
-              comparator.copy(slot, doc);
-              add(slot, doc, score);
-              if (queueFull) {
-                comparator.setBottom(bottom.slot);
-              }
-            }
-          }
-
-          @Override
-          public boolean acceptsDocsOutOfOrder() {
-            return true;
-          }
-
-        };
-      } else {
-        return new MultiComparatorLeafCollector(comparators, reverseMul) {
-
-          @Override
-          public void collect(int doc) throws IOException {
-            ++totalHits;
-            if (queueFull) {
-              // Fastmatch: return if this hit is not competitive
-              final int cmp = compareBottom(doc);
-              if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.doc)) {
-                return;
-              }
-
-              // Compute the score only if the hit is competitive.
-              final float score = scorer.score();
-
-              // This hit is competitive - replace bottom element in queue & adjustTop
-              copy(bottom.slot, doc);
-              updateBottom(doc, score);
-              setBottom(bottom.slot);
-            } else {
-              // Compute the score only if the hit is competitive.
-              final float score = scorer.score();
-
-              // Startup transient: queue hasn't gathered numHits yet
-              final int slot = totalHits - 1;
-              // Copy hit into queue
-              copy(slot, doc);
-              add(slot, doc, score);
-              if (queueFull) {
-                setBottom(bottom.slot);
-              }
-            }
-          }
-
-          @Override
-          public boolean acceptsDocsOutOfOrder() {
-            return true;
-          }
-        };
-      }
-    }
-
-  }
-
-  /*
    * Implements a TopFieldCollector over one SortField criteria, with tracking
    * document scores and maxScore.
    */
@@ -617,109 +404,6 @@ public abstract class TopFieldCollector
   }
 
   /*
-   * Implements a TopFieldCollector over one SortField criteria, with tracking
-   * document scores and maxScore, and assumes out of orderness in doc Ids
-   * collection.
-   */
-  private static class OutOfOrderScoringMaxScoreCollector extends TopFieldCollector {
-
-    final FieldValueHitQueue<Entry> queue;
-
-    public OutOfOrderScoringMaxScoreCollector(FieldValueHitQueue<Entry> queue, int numHits, boolean fillFields) {
-      super(queue, numHits, fillFields);
-      this.queue = queue;
-      maxScore = Float.MIN_NORMAL; // otherwise we would keep NaN
-    }
-
-    @Override
-    public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException {
-      docBase = context.docBase;
-
-      final LeafFieldComparator[] comparators = queue.getComparators(context);
-      final int[] reverseMul = queue.getReverseMul();
-
-      if (comparators.length == 1) {
-        return new OneComparatorLeafCollector(comparators[0], reverseMul[0]) {
-
-          @Override
-          public void collect(int doc) throws IOException {
-            final float score = scorer.score();
-            if (score > maxScore) {
-              maxScore = score;
-            }
-            ++totalHits;
-            if (queueFull) {
-              // Fastmatch: return if this hit is not competitive
-              final int cmp = reverseMul * comparator.compareBottom(doc);
-              if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.doc)) {
-                return;
-              }
-
-              // This hit is competitive - replace bottom element in queue & adjustTop
-              comparator.copy(bottom.slot, doc);
-              updateBottom(doc, score);
-              comparator.setBottom(bottom.slot);
-            } else {
-              // Startup transient: queue hasn't gathered numHits yet
-              final int slot = totalHits - 1;
-              // Copy hit into queue
-              comparator.copy(slot, doc);
-              add(slot, doc, score);
-              if (queueFull) {
-                comparator.setBottom(bottom.slot);
-              }
-            }
-          }
-
-          @Override
-          public boolean acceptsDocsOutOfOrder() {
-            return true;
-          }
-        };
-      } else {
-        return new MultiComparatorLeafCollector(comparators, reverseMul) {
-
-          @Override
-          public void collect(int doc) throws IOException {
-            final float score = scorer.score();
-            if (score > maxScore) {
-              maxScore = score;
-            }
-            ++totalHits;
-            if (queueFull) {
-              // Fastmatch: return if this hit is not competitive
-              final int cmp = compareBottom(doc);
-              if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.doc)) {
-                return;
-              }
-
-              // This hit is competitive - replace bottom element in queue & adjustTop
-              copy(bottom.slot, doc);
-              updateBottom(doc, score);
-              setBottom(bottom.slot);
-            } else {
-              // Startup transient: queue hasn't gathered numHits yet
-              final int slot = totalHits - 1;
-              // Copy hit into queue
-              copy(slot, doc);
-              add(slot, doc, score);
-              if (queueFull) {
-                setBottom(bottom.slot);
-              }
-            }
-          }
-
-          @Override
-          public boolean acceptsDocsOutOfOrder() {
-            return true;
-          }
-        };
-      }
-    }
-
-  }
-
-  /*
    * Implements a TopFieldCollector when after != null.
    */
   private final static class PagingFieldCollector extends TopFieldCollector {
@@ -774,8 +458,8 @@ public abstract class TopFieldCollector
             // Fastmatch: return if this hit is no better than
             // the worst hit currently in the queue:
             final int cmp = compareBottom(doc);
-            if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.doc)) {
-              // Definitely not competitive.
+            if (cmp <= 0) {
+              // not competitive since documents are visited in doc id order
               return;
             }
           }
@@ -817,11 +501,6 @@ public abstract class TopFieldCollector
             }
           }
         }
-
-        @Override
-        public boolean acceptsDocsOutOfOrder() {
-          return true;
-        }
       };
     }
 
@@ -882,18 +561,14 @@ public abstract class TopFieldCollector
    *          true affects performance as it incurs the score computation on
    *          each result. Also, setting this true automatically sets
    *          <code>trackDocScores</code> to true as well.
-   * @param docsScoredInOrder
-   *          specifies whether documents are scored in doc Id order or not by
-   *          the given {@link Scorer} in {@link LeafCollector#setScorer(Scorer)}.
    * @return a {@link TopFieldCollector} instance which will sort the results by
    *         the sort criteria.
    * @throws IOException if there is a low-level I/O error
    */
   public static TopFieldCollector create(Sort sort, int numHits,
-      boolean fillFields, boolean trackDocScores, boolean trackMaxScore,
-      boolean docsScoredInOrder)
+      boolean fillFields, boolean trackDocScores, boolean trackMaxScore)
       throws IOException {
-    return create(sort, numHits, null, fillFields, trackDocScores, trackMaxScore, docsScoredInOrder);
+    return create(sort, numHits, null, fillFields, trackDocScores, trackMaxScore);
   }
 
   /**
@@ -927,16 +602,12 @@ public abstract class TopFieldCollector
    *          true affects performance as it incurs the score computation on
    *          each result. Also, setting this true automatically sets
    *          <code>trackDocScores</code> to true as well.
-   * @param docsScoredInOrder
-   *          specifies whether documents are scored in doc Id order or not by
-   *          the given {@link Scorer} in {@link LeafCollector#setScorer(Scorer)}.
    * @return a {@link TopFieldCollector} instance which will sort the results by
    *         the sort criteria.
    * @throws IOException if there is a low-level I/O error
    */
   public static TopFieldCollector create(Sort sort, int numHits, FieldDoc after,
-      boolean fillFields, boolean trackDocScores, boolean trackMaxScore,
-      boolean docsScoredInOrder)
+      boolean fillFields, boolean trackDocScores, boolean trackMaxScore)
       throws IOException {
 
     if (sort.fields.length == 0) {
@@ -950,22 +621,12 @@ public abstract class TopFieldCollector
     FieldValueHitQueue<Entry> queue = FieldValueHitQueue.create(sort.fields, numHits);
 
     if (after == null) {
-      if (docsScoredInOrder) {
-        if (trackMaxScore) {
-          return new ScoringMaxScoreCollector(queue, numHits, fillFields);
-        } else if (trackDocScores) {
-          return new ScoringNoMaxScoreCollector(queue, numHits, fillFields);
-        } else {
-          return new NonScoringCollector(queue, numHits, fillFields);
-        }
+      if (trackMaxScore) {
+        return new ScoringMaxScoreCollector(queue, numHits, fillFields);
+      } else if (trackDocScores) {
+        return new ScoringNoMaxScoreCollector(queue, numHits, fillFields);
       } else {
-        if (trackMaxScore) {
-          return new OutOfOrderScoringMaxScoreCollector(queue, numHits, fillFields);
-        } else if (trackDocScores) {
-          return new OutOfOrderScoringNoMaxScoreCollector(queue, numHits, fillFields);
-        } else {
-          return new OutOfOrderNonScoringCollector(queue, numHits, fillFields);
-        }
+        return new NonScoringCollector(queue, numHits, fillFields);
       }
     } else {
       if (after.fields == null) {

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TopScoreDocCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TopScoreDocCollector.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TopScoreDocCollector.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TopScoreDocCollector.java Thu Jan 15 10:19:28 2015
@@ -36,13 +36,7 @@ import org.apache.lucene.index.LeafReade
  */
 public abstract class TopScoreDocCollector extends TopDocsCollector<ScoreDoc> {
 
-  private abstract static class ScorerLeafCollector implements LeafCollector {
-
-    final boolean scoreDocsInOrder;
-
-    ScorerLeafCollector(boolean scoreDocsInOrder) {
-      this.scoreDocsInOrder = scoreDocsInOrder;
-    }
+  abstract static class ScorerLeafCollector implements LeafCollector {
 
     Scorer scorer;
 
@@ -51,90 +45,52 @@ public abstract class TopScoreDocCollect
       this.scorer = scorer;
     }
 
-    @Override
-    public boolean acceptsDocsOutOfOrder() {
-      return scoreDocsInOrder == false;
-    }
-
   }
 
   private static class SimpleTopScoreDocCollector extends TopScoreDocCollector {
 
-    private final boolean scoreDocsInOrder;
-
-    SimpleTopScoreDocCollector(int numHits, boolean scoreDocsInOrder) {
+    SimpleTopScoreDocCollector(int numHits) {
       super(numHits);
-      this.scoreDocsInOrder = scoreDocsInOrder;
     }
 
     @Override
     public LeafCollector getLeafCollector(LeafReaderContext context)
         throws IOException {
       final int docBase = context.docBase;
-      if (scoreDocsInOrder) {
-        return new ScorerLeafCollector(scoreDocsInOrder) {
+      return new ScorerLeafCollector() {
 
-          @Override
-          public void collect(int doc) throws IOException {
-            float score = scorer.score();
-
-            // This collector cannot handle these scores:
-            assert score != Float.NEGATIVE_INFINITY;
-            assert !Float.isNaN(score);
-
-            totalHits++;
-            if (score <= pqTop.score) {
-              // Since docs are returned in-order (i.e., increasing doc Id), a document
-              // with equal score to pqTop.score cannot compete since HitQueue favors
-              // documents with lower doc Ids. Therefore reject those docs too.
-              return;
-            }
-            pqTop.doc = doc + docBase;
-            pqTop.score = score;
-            pqTop = pq.updateTop();
+        @Override
+        public void collect(int doc) throws IOException {
+          float score = scorer.score();
+
+          // This collector cannot handle these scores:
+          assert score != Float.NEGATIVE_INFINITY;
+          assert !Float.isNaN(score);
+
+          totalHits++;
+          if (score <= pqTop.score) {
+            // Since docs are returned in-order (i.e., increasing doc Id), a document
+            // with equal score to pqTop.score cannot compete since HitQueue favors
+            // documents with lower doc Ids. Therefore reject those docs too.
+            return;
           }
+          pqTop.doc = doc + docBase;
+          pqTop.score = score;
+          pqTop = pq.updateTop();
+        }
 
-        };
-      } else {
-        return new ScorerLeafCollector(scoreDocsInOrder) {
-
-          @Override
-          public void collect(int doc) throws IOException {
-            float score = scorer.score();
-
-            // This collector cannot handle NaN
-            assert !Float.isNaN(score);
-
-            totalHits++;
-            if (score < pqTop.score) {
-              // Doesn't compete w/ bottom entry in queue
-              return;
-            }
-            doc += docBase;
-            if (score == pqTop.score && doc > pqTop.doc) {
-              // Break tie in score by doc ID:
-              return;
-            }
-            pqTop.doc = doc;
-            pqTop.score = score;
-            pqTop = pq.updateTop();
-          }
-
-        };
-      }
+      };
     }
 
   }
 
   private static class PagingTopScoreDocCollector extends TopScoreDocCollector {
 
-    private final boolean scoreDocsInOrder;
     private final ScoreDoc after;
     private int collectedHits;
 
-    PagingTopScoreDocCollector(int numHits, boolean scoreDocsInOrder, ScoreDoc after) {
+    PagingTopScoreDocCollector(int numHits, ScoreDoc after) {
       super(numHits);
-      this.scoreDocsInOrder = scoreDocsInOrder;
       this.after = after;
       this.collectedHits = 0;
     }
@@ -153,65 +109,34 @@ public abstract class TopScoreDocCollect
     public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException {
       final int docBase = context.docBase;
       final int afterDoc = after.doc - context.docBase;
-      if (scoreDocsInOrder) {
-        return new ScorerLeafCollector(scoreDocsInOrder) {
-          @Override
-          public void collect(int doc) throws IOException {
-            float score = scorer.score();
-
-            // This collector cannot handle these scores:
-            assert score != Float.NEGATIVE_INFINITY;
-            assert !Float.isNaN(score);
-
-            totalHits++;
-
-            if (score > after.score || (score == after.score && doc <= afterDoc)) {
-              // hit was collected on a previous page
-              return;
-            }
-
-            if (score <= pqTop.score) {
-              // Since docs are returned in-order (i.e., increasing doc Id), a document
-              // with equal score to pqTop.score cannot compete since HitQueue favors
-              // documents with lower doc Ids. Therefore reject those docs too.
-              return;
-            }
-            collectedHits++;
-            pqTop.doc = doc + docBase;
-            pqTop.score = score;
-            pqTop = pq.updateTop();
+      return new ScorerLeafCollector() {
+        @Override
+        public void collect(int doc) throws IOException {
+          float score = scorer.score();
+
+          // This collector cannot handle these scores:
+          assert score != Float.NEGATIVE_INFINITY;
+          assert !Float.isNaN(score);
+
+          totalHits++;
+
+          if (score > after.score || (score == after.score && doc <= afterDoc)) {
+            // hit was collected on a previous page
+            return;
           }
-        };
-      } else {
-        return new ScorerLeafCollector(scoreDocsInOrder) {
-          @Override
-          public void collect(int doc) throws IOException {
-            float score = scorer.score();
-
-            // This collector cannot handle NaN
-            assert !Float.isNaN(score);
-
-            totalHits++;
-            if (score > after.score || (score == after.score && doc <= afterDoc)) {
-              // hit was collected on a previous page
-              return;
-            }
-            if (score < pqTop.score) {
-              // Doesn't compete w/ bottom entry in queue
-              return;
-            }
-            doc += docBase;
-            if (score == pqTop.score && doc > pqTop.doc) {
-              // Break tie in score by doc ID:
-              return;
-            }
-            collectedHits++;
-            pqTop.doc = doc;
-            pqTop.score = score;
-            pqTop = pq.updateTop();
+
+          if (score <= pqTop.score) {
+            // Since docs are returned in-order (i.e., increasing doc Id), a document
+            // with equal score to pqTop.score cannot compete since HitQueue favors
+            // documents with lower doc Ids. Therefore reject those docs too.
+            return;
           }
-        };
-      }
+          collectedHits++;
+          pqTop.doc = doc + docBase;
+          pqTop.score = score;
+          pqTop = pq.updateTop();
+        }
+      };
     }
   }
 
@@ -225,8 +150,8 @@ public abstract class TopScoreDocCollect
    * <code>numHits</code>, and fill the array with sentinel
    * objects.
    */
-  public static TopScoreDocCollector create(int numHits, boolean docsScoredInOrder) {
-    return create(numHits, null, docsScoredInOrder);
+  public static TopScoreDocCollector create(int numHits) {
+    return create(numHits, null);
   }
 
   /**
@@ -239,23 +164,23 @@ public abstract class TopScoreDocCollect
    * <code>numHits</code>, and fill the array with sentinel
    * objects.
    */
-  public static TopScoreDocCollector create(int numHits, ScoreDoc after, boolean docsScoredInOrder) {
+  public static TopScoreDocCollector create(int numHits, ScoreDoc after) {
 
     if (numHits <= 0) {
       throw new IllegalArgumentException("numHits must be > 0; please use TotalHitCountCollector if you just need the total hit count");
     }
 
     if (after == null) {
-      return new SimpleTopScoreDocCollector(numHits, docsScoredInOrder);
+      return new SimpleTopScoreDocCollector(numHits);
     } else {
-      return new PagingTopScoreDocCollector(numHits, docsScoredInOrder, after);
+      return new PagingTopScoreDocCollector(numHits, after);
     }
   }
 
   ScoreDoc pqTop;
 
   // prevents instantiation
-  private TopScoreDocCollector(int numHits) {
+  TopScoreDocCollector(int numHits) {
     super(new HitQueue(numHits, true));
     // HitQueue implements getSentinelObject to return a ScoreDoc, so we know
     // that at this point top() is already initialized.

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TotalHitCountCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TotalHitCountCollector.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TotalHitCountCollector.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/TotalHitCountCollector.java Thu Jan 15 10:19:28 2015
@@ -34,9 +34,4 @@ public class TotalHitCountCollector exte
   public void collect(int doc) {
     totalHits++;
   }
-
-  @Override
-  public boolean acceptsDocsOutOfOrder() {
-    return true;
-  }
 }

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/Weight.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/Weight.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/Weight.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/Weight.java Thu Jan 15 10:19:28 2015
@@ -79,11 +79,6 @@ public abstract class Weight {
    * Returns a {@link Scorer} which scores documents in/out-of order according
    * to <code>scoreDocsInOrder</code>.
    * <p>
-   * <b>NOTE:</b> even if <code>scoreDocsInOrder</code> is false, it is
-   * recommended to check whether the returned <code>Scorer</code> indeed scores
-   * documents out of order (i.e., call {@link #scoresDocsOutOfOrder()}), as
-   * some <code>Scorer</code> implementations will always return documents
-   * in-order.<br>
    * <b>NOTE:</b> null can be returned if no documents will be scored by this
    * query.
    * 
@@ -108,15 +103,6 @@ public abstract class Weight {
    *
    * @param context
    *          the {@link org.apache.lucene.index.LeafReaderContext} for which to return the {@link Scorer}.
-   * @param scoreDocsInOrder
-   *          specifies whether in-order scoring of documents is required. Note
-   *          that if set to false (i.e., out-of-order scoring is required),
-   *          this method can return whatever scoring mode it supports, as every
-   *          in-order scorer is also an out-of-order one. However, an
-   *          out-of-order scorer may not support {@link Scorer#nextDoc()}
-   *          and/or {@link Scorer#advance(int)}, therefore it is recommended to
-   *          request an in-order scorer if use of these
-   *          methods is required.
    * @param acceptDocs
    *          Bits that represent the allowable docs to match (typically deleted docs
    *          but possibly filtering other documents)
@@ -125,7 +111,7 @@ public abstract class Weight {
    * passes them to a collector.
    * @throws IOException if there is a low-level I/O error
    */
-  public BulkScorer bulkScorer(LeafReaderContext context, boolean scoreDocsInOrder, Bits acceptDocs) throws IOException {
+  public BulkScorer bulkScorer(LeafReaderContext context, Bits acceptDocs) throws IOException {
 
     Scorer scorer = scorer(context, acceptDocs);
     if (scorer == null) {
@@ -193,19 +179,4 @@ public abstract class Weight {
       }
     }
   }
-
-  /**
-   * Returns true iff this implementation scores docs only out of order. This
-   * method is used in conjunction with {@link Collector}'s
-   * {@link LeafCollector#acceptsDocsOutOfOrder() acceptsDocsOutOfOrder} and
-   * {@link #bulkScorer(org.apache.lucene.index.LeafReaderContext, boolean, Bits)} to
-   * create a matching {@link Scorer} instance for a given {@link Collector}, or
-   * vice versa.
-   * <p>
-   * <b>NOTE:</b> the default implementation returns <code>false</code>, i.e.
-   * the <code>Scorer</code> scores documents in-order.
-   */
-  public boolean scoresDocsOutOfOrder() {
-    return false;
-  }
 }

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/package.html?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/package.html (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/search/package.html Thu Jan 15 10:19:28 2015
@@ -443,8 +443,8 @@ on the built-in available scoring models
                 given the Query.
             </li>
             <li>
-                {@link org.apache.lucene.search.Weight#bulkScorer(org.apache.lucene.index.LeafReaderContext, boolean, org.apache.lucene.util.Bits)
-                  scorer(LeafReaderContext context, boolean scoreDocsInOrder, Bits acceptDocs)} &mdash;
+                {@link org.apache.lucene.search.Weight#bulkScorer(org.apache.lucene.index.LeafReaderContext, org.apache.lucene.util.Bits)
+                  scorer(LeafReaderContext context, Bits acceptDocs)} &mdash;
                 Construct a new {@link org.apache.lucene.search.BulkScorer BulkScorer} for this Weight. See <a href="#bulkScorerClass">The BulkScorer Class</a>
                 below for help defining a BulkScorer. This is an optional method, and most queries do not implement it.
             </li>

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java Thu Jan 15 10:19:28 2015
@@ -437,10 +437,6 @@ public class TestOmitTf extends LuceneTe
     protected void doSetNextReader(LeafReaderContext context) throws IOException {
       docBase = context.docBase;
     }
-    @Override
-    public boolean acceptsDocsOutOfOrder() {
-      return true;
-    }
   }
   
   /** test that when freqs are omitted, that totalTermFreq and sumTotalTermFreq are -1 */

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java Thu Jan 15 10:19:28 2015
@@ -52,11 +52,6 @@ final class JustCompileSearch {
     public void setScorer(Scorer scorer) {
       throw new UnsupportedOperationException(UNSUPPORTED_MSG);
     }
-    
-    @Override
-    public boolean acceptsDocsOutOfOrder() {
-      throw new UnsupportedOperationException(UNSUPPORTED_MSG);
-    }
 
   }
   

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/MultiCollectorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/MultiCollectorTest.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/MultiCollectorTest.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/MultiCollectorTest.java Thu Jan 15 10:19:28 2015
@@ -27,18 +27,11 @@ public class MultiCollectorTest extends
 
   private static class DummyCollector extends SimpleCollector {
 
-    boolean acceptsDocsOutOfOrderCalled = false;
     boolean collectCalled = false;
     boolean setNextReaderCalled = false;
     boolean setScorerCalled = false;
 
     @Override
-    public boolean acceptsDocsOutOfOrder() {
-      acceptsDocsOutOfOrderCalled = true;
-      return true;
-    }
-
-    @Override
     public void collect(int doc) throws IOException {
       collectCalled = true;
     }
@@ -70,7 +63,6 @@ public class MultiCollectorTest extends
     Collector c = MultiCollector.wrap(new DummyCollector(), null, new DummyCollector());
     assertTrue(c instanceof MultiCollector);
     final LeafCollector ac = c.getLeafCollector(null);
-    assertTrue(ac.acceptsDocsOutOfOrder());
     ac.collect(1);
     c.getLeafCollector(null);
     c.getLeafCollector(null).setScorer(null);
@@ -93,13 +85,11 @@ public class MultiCollectorTest extends
     DummyCollector[] dcs = new DummyCollector[] { new DummyCollector(), new DummyCollector() };
     Collector c = MultiCollector.wrap(dcs);
     LeafCollector ac = c.getLeafCollector(null);
-    assertTrue(ac.acceptsDocsOutOfOrder());
     ac.collect(1);
     ac = c.getLeafCollector(null);
     ac.setScorer(null);
 
     for (DummyCollector dc : dcs) {
-      assertTrue(dc.acceptsDocsOutOfOrderCalled);
       assertTrue(dc.collectCalled);
       assertTrue(dc.setNextReaderCalled);
       assertTrue(dc.setScorerCalled);

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestBoolean2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestBoolean2.java?rev=1652034&r1=1652033&r2=1652034&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestBoolean2.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/test/org/apache/lucene/search/TestBoolean2.java Thu Jan 15 10:19:28 2015
@@ -130,11 +130,14 @@ public class TestBoolean2 extends Lucene
   };
 
   public void queriesTest(Query query, int[] expDocNrs) throws Exception {
-    TopScoreDocCollector collector = TopScoreDocCollector.create(1000, false);
+    // The asserting searcher will sometimes return the bulk scorer and
+    // sometimes return a default impl around the scorer so that we can
+    // compare BS1 and BS2
+    TopScoreDocCollector collector = TopScoreDocCollector.create(1000);
     searcher.search(query, null, collector);
     ScoreDoc[] hits1 = collector.topDocs().scoreDocs;
 
-    collector = TopScoreDocCollector.create(1000, true);
+    collector = TopScoreDocCollector.create(1000);
     searcher.search(query, null, collector);
     ScoreDoc[] hits2 = collector.topDocs().scoreDocs; 
 
@@ -282,13 +285,13 @@ public class TestBoolean2 extends Lucene
         }
 
         TopFieldCollector collector = TopFieldCollector.create(sort, 1000,
-            false, true, true, true);
+            false, true, true);
 
         searcher.search(q1, null, collector);
         ScoreDoc[] hits1 = collector.topDocs().scoreDocs;
 
         collector = TopFieldCollector.create(sort, 1000,
-            false, true, true, false);
+            false, true, true);
         
         searcher.search(q1, null, collector);
         ScoreDoc[] hits2 = collector.topDocs().scoreDocs;



Mime
View raw message