mirror of https://github.com/apache/lucene.git
LUCENE-6179: Leftovers.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1652015 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
457e70ab94
commit
927827a215
|
@ -290,11 +290,8 @@ public abstract class CachingCollector extends FilterCollector {
|
||||||
* Creates a {@link CachingCollector} which does not wrap another collector.
|
* Creates a {@link CachingCollector} which does not wrap another collector.
|
||||||
* The cached documents and scores can later be {@link #replay(Collector)
|
* The cached documents and scores can later be {@link #replay(Collector)
|
||||||
* replayed}.
|
* 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() {
|
Collector other = new SimpleCollector() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -56,14 +56,9 @@ import java.io.IOException;
|
||||||
* bits.set(docBase + doc);
|
* bits.set(docBase + doc);
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* // accept docs out of order (for a BitSet it doesn't matter)
|
|
||||||
* public boolean acceptsDocsOutOfOrder() {
|
|
||||||
* return true;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* };
|
* };
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* });
|
* });
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
|
|
@ -326,32 +326,6 @@ public class TestBooleanQuery extends LuceneTestCase {
|
||||||
directory.close();
|
directory.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// LUCENE-5487
|
|
||||||
public void testInOrderWithMinShouldMatch() throws Exception {
|
|
||||||
Directory dir = newDirectory();
|
|
||||||
RandomIndexWriter w = new RandomIndexWriter(random(), dir);
|
|
||||||
Document doc = new Document();
|
|
||||||
doc.add(newTextField("field", "some text here", Field.Store.NO));
|
|
||||||
w.addDocument(doc);
|
|
||||||
IndexReader r = w.getReader();
|
|
||||||
w.close();
|
|
||||||
IndexSearcher s = new IndexSearcher(r) {
|
|
||||||
@Override
|
|
||||||
protected void search(List<LeafReaderContext> leaves, Weight weight, Collector collector) throws IOException {
|
|
||||||
assertEquals(-1, collector.getClass().getSimpleName().indexOf("OutOfOrder"));
|
|
||||||
super.search(leaves, weight, collector);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
BooleanQuery bq = new BooleanQuery();
|
|
||||||
bq.add(new TermQuery(new Term("field", "some")), BooleanClause.Occur.SHOULD);
|
|
||||||
bq.add(new TermQuery(new Term("field", "text")), BooleanClause.Occur.SHOULD);
|
|
||||||
bq.add(new TermQuery(new Term("field", "here")), BooleanClause.Occur.SHOULD);
|
|
||||||
bq.setMinimumNumberShouldMatch(2);
|
|
||||||
s.search(bq, 10);
|
|
||||||
r.close();
|
|
||||||
dir.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testOneClauseRewriteOptimization() throws Exception {
|
public void testOneClauseRewriteOptimization() throws Exception {
|
||||||
final float BOOST = 3.5F;
|
final float BOOST = 3.5F;
|
||||||
final String FIELD = "content";
|
final String FIELD = "content";
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class TestCachingCollector extends LuceneTestCase {
|
||||||
public void testNoWrappedCollector() throws Exception {
|
public void testNoWrappedCollector() throws Exception {
|
||||||
for (boolean cacheScores : new boolean[] { false, true }) {
|
for (boolean cacheScores : new boolean[] { false, true }) {
|
||||||
// create w/ null wrapped collector, and test that the methods work
|
// create w/ null wrapped collector, and test that the methods work
|
||||||
CachingCollector cc = CachingCollector.create(true, cacheScores, 50 * ONE_BYTE);
|
CachingCollector cc = CachingCollector.create(cacheScores, 50 * ONE_BYTE);
|
||||||
LeafCollector acc = cc.getLeafCollector(null);
|
LeafCollector acc = cc.getLeafCollector(null);
|
||||||
acc.setScorer(new MockScorer());
|
acc.setScorer(new MockScorer());
|
||||||
acc.collect(0);
|
acc.collect(0);
|
||||||
|
|
|
@ -878,7 +878,7 @@ public class TestGrouping extends LuceneTestCase {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Collect only into cache, then replay multiple times:
|
// Collect only into cache, then replay multiple times:
|
||||||
c = cCache = CachingCollector.create(false, true, maxCacheMB);
|
c = cCache = CachingCollector.create(true, maxCacheMB);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cCache = null;
|
cCache = null;
|
||||||
|
|
|
@ -21,8 +21,7 @@ import java.io.IOException;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
/** Wraps another Collector and checks that
|
/** Wraps another Collector and checks that
|
||||||
* acceptsDocsOutOfOrder is respected. */
|
* order is respected. */
|
||||||
|
|
||||||
final class AssertingLeafCollector extends FilterLeafCollector {
|
final class AssertingLeafCollector extends FilterLeafCollector {
|
||||||
|
|
||||||
private final Random random;
|
private final Random random;
|
||||||
|
|
Loading…
Reference in New Issue