use of io.crate.operation.reference.doc.lucene.FloatColumnReference in project crate by crate.
the class FloatColumnReferenceTest method testFieldCacheExpression.
@Test
public void testFieldCacheExpression() throws Exception {
MappedFieldType fieldType = FloatFieldMapper.Defaults.FIELD_TYPE.clone();
fieldType.setNames(new MappedFieldType.Names(column));
FloatColumnReference floatColumn = new FloatColumnReference(column, fieldType);
floatColumn.startCollect(ctx);
floatColumn.setNextReader(readerContext);
IndexSearcher searcher = new IndexSearcher(readerContext.reader());
TopDocs topDocs = searcher.search(new MatchAllDocsQuery(), 10);
float f = -0.5f;
for (ScoreDoc doc : topDocs.scoreDocs) {
floatColumn.setNextDocId(doc.doc);
assertThat(floatColumn.value(), is(f));
f++;
}
}
Aggregations