Search in sources :

Example 1 with ByteColumnReference

use of io.crate.operation.reference.doc.lucene.ByteColumnReference 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++;
    }
}
Also used : IndexSearcher(org.apache.lucene.search.IndexSearcher) TopDocs(org.apache.lucene.search.TopDocs) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) ByteColumnReference(io.crate.operation.reference.doc.lucene.ByteColumnReference) ScoreDoc(org.apache.lucene.search.ScoreDoc) Test(org.junit.Test)

Aggregations

ByteColumnReference (io.crate.operation.reference.doc.lucene.ByteColumnReference)1 IndexSearcher (org.apache.lucene.search.IndexSearcher)1 MatchAllDocsQuery (org.apache.lucene.search.MatchAllDocsQuery)1 ScoreDoc (org.apache.lucene.search.ScoreDoc)1 TopDocs (org.apache.lucene.search.TopDocs)1 Test (org.junit.Test)1