use of org.apache.lucene.search.MatchAllDocsQuery in project crate by crate.
the class LuceneBatchIteratorBenchmark method measureConsumeLuceneBatchIterator.
@Benchmark
public void measureConsumeLuceneBatchIterator(Blackhole blackhole) throws Exception {
LuceneBatchIterator it = new LuceneBatchIterator(indexSearcher, new MatchAllDocsQuery(), null, false, collectorContext, RAM_ACCOUNTING_CONTEXT, columnRefs, columnRefs);
Input<?> input = it.rowData().get(0);
while (it.moveNext()) {
blackhole.consume(input.value());
}
}
use of org.apache.lucene.search.MatchAllDocsQuery in project crate by crate.
the class BooleanColumnReferenceTest method testBooleanExpression.
@Test
public void testBooleanExpression() throws Exception {
BooleanColumnReference booleanColumn = new BooleanColumnReference(column);
booleanColumn.startCollect(ctx);
booleanColumn.setNextReader(readerContext);
IndexSearcher searcher = new IndexSearcher(readerContext.reader());
TopDocs topDocs = searcher.search(new MatchAllDocsQuery(), 20);
int i = 0;
for (ScoreDoc doc : topDocs.scoreDocs) {
booleanColumn.setNextDocId(doc.doc);
assertThat(booleanColumn.value(), is(i % 2 == 0));
i++;
}
}
use of org.apache.lucene.search.MatchAllDocsQuery in project crate by crate.
the class ByteColumnReferenceTest method testByteExpression.
@Test
public void testByteExpression() throws Exception {
ByteColumnReference byteColumn = new ByteColumnReference(column);
byteColumn.startCollect(ctx);
byteColumn.setNextReader(readerContext);
IndexSearcher searcher = new IndexSearcher(readerContext.reader());
TopDocs topDocs = searcher.search(new MatchAllDocsQuery(), 20);
byte b = -10;
for (ScoreDoc doc : topDocs.scoreDocs) {
byteColumn.setNextDocId(doc.doc);
assertThat(byteColumn.value(), is(b));
b++;
}
}
use of org.apache.lucene.search.MatchAllDocsQuery in project crate by crate.
the class ShortColumnReferenceTest method testShortExpression.
@Test
public void testShortExpression() throws Exception {
ShortColumnReference shortColumn = new ShortColumnReference(column);
shortColumn.startCollect(ctx);
shortColumn.setNextReader(readerContext);
IndexSearcher searcher = new IndexSearcher(readerContext.reader());
TopDocs topDocs = searcher.search(new MatchAllDocsQuery(), 20);
short i = -10;
for (ScoreDoc doc : topDocs.scoreDocs) {
shortColumn.setNextDocId(doc.doc);
assertThat(shortColumn.value(), is(i));
i++;
}
}
use of org.apache.lucene.search.MatchAllDocsQuery in project crate by crate.
the class LuceneBatchIteratorTest method testLuceneBatchIterator.
@Test
public void testLuceneBatchIterator() throws Exception {
BatchIteratorTester tester = new BatchIteratorTester(() -> {
return new LuceneBatchIterator(indexSearcher, new MatchAllDocsQuery(), null, false, new CollectorContext(mock(IndexFieldDataService.class), new CollectorFieldsVisitor(0)), new RamAccountingContext("dummy", new NoopCircuitBreaker("dummy")), columnRefs, columnRefs);
});
tester.verifyResultAndEdgeCaseBehaviour(expectedResult);
}
Aggregations