Search in sources :

Example 6 with CollectorContext

use of io.crate.operation.reference.doc.lucene.CollectorContext in project crate by crate.

the class LuceneBatchIteratorBenchmark method createLuceneBatchIterator.

@Setup
public void createLuceneBatchIterator() throws Exception {
    IndexWriter iw = new IndexWriter(new RAMDirectory(), new IndexWriterConfig(new StandardAnalyzer()));
    String columnName = "x";
    for (int i = 0; i < 10_000_000; i++) {
        Document doc = new Document();
        doc.add(new NumericDocValuesField(columnName, i));
        iw.addDocument(doc);
    }
    iw.commit();
    iw.forceMerge(1, true);
    indexSearcher = new IndexSearcher(DirectoryReader.open(iw, true));
    IntegerColumnReference columnReference = new IntegerColumnReference(columnName);
    columnRefs = Collections.singletonList(columnReference);
    collectorContext = new CollectorContext(mock(IndexFieldDataService.class), new CollectorFieldsVisitor(0));
}
Also used : IndexSearcher(org.apache.lucene.search.IndexSearcher) NumericDocValuesField(org.apache.lucene.document.NumericDocValuesField) IndexWriter(org.apache.lucene.index.IndexWriter) StandardAnalyzer(org.apache.lucene.analysis.standard.StandardAnalyzer) IntegerColumnReference(io.crate.operation.reference.doc.lucene.IntegerColumnReference) CollectorContext(io.crate.operation.reference.doc.lucene.CollectorContext) Document(org.apache.lucene.document.Document) RAMDirectory(org.apache.lucene.store.RAMDirectory) IndexWriterConfig(org.apache.lucene.index.IndexWriterConfig)

Aggregations

CollectorContext (io.crate.operation.reference.doc.lucene.CollectorContext)6 StandardAnalyzer (org.apache.lucene.analysis.standard.StandardAnalyzer)3 RAMDirectory (org.apache.lucene.store.RAMDirectory)3 Document (org.apache.lucene.document.Document)2 NumericDocValuesField (org.apache.lucene.document.NumericDocValuesField)2 IndexWriter (org.apache.lucene.index.IndexWriter)2 IndexWriterConfig (org.apache.lucene.index.IndexWriterConfig)2 IndexService (org.elasticsearch.index.IndexService)2 ShardId (org.elasticsearch.index.shard.ShardId)2 OrderBy (io.crate.analyze.OrderBy)1 RamAccountingContext (io.crate.breaker.RamAccountingContext)1 LuceneQueryBuilder (io.crate.lucene.LuceneQueryBuilder)1 Reference (io.crate.metadata.Reference)1 ReferenceIdent (io.crate.metadata.ReferenceIdent)1 TableIdent (io.crate.metadata.TableIdent)1 InputFactory (io.crate.operation.InputFactory)1 LuceneOrderedDocCollector (io.crate.operation.collect.collectors.LuceneOrderedDocCollector)1 IntegerColumnReference (io.crate.operation.reference.doc.lucene.IntegerColumnReference)1 LuceneCollectorExpression (io.crate.operation.reference.doc.lucene.LuceneCollectorExpression)1 OrderByCollectorExpression (io.crate.operation.reference.doc.lucene.OrderByCollectorExpression)1