Module org.elasticsearch.compute
Package org.elasticsearch.compute.lucene
Class LuceneQueryEvaluator<T extends Vector.Builder>
java.lang.Object
org.elasticsearch.compute.lucene.LuceneQueryEvaluator<T>
- All Implemented Interfaces:
Closeable,AutoCloseable,org.elasticsearch.core.Releasable
- Direct Known Subclasses:
LuceneQueryExpressionEvaluator,LuceneQueryScoreEvaluator
public abstract class LuceneQueryEvaluator<T extends Vector.Builder>
extends Object
implements org.elasticsearch.core.Releasable
Base class for evaluating a Lucene query at the compute engine and providing a Block as a result.
Subclasses can override methods to decide what type of
Block should be returned, and how to add results to it
based on documents on the Page matching the query or not.
See LuceneQueryExpressionEvaluator for an example of how to use this class and LuceneQueryScoreEvaluator for
examples of subclasses that provide different types of scoring results for different ESQL constructs.
It's much faster to push queries to the LuceneSourceOperator or the like, but sometimes this isn't possible. So
this class is here to save the day.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLuceneQueryEvaluator(BlockFactory blockFactory, LuceneQueryEvaluator.ShardConfig[] shards) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidappendMatch(T builder, org.apache.lucene.search.Scorable scorer) Appends a matching result to a builder created by @link createVectorBuilder}protected abstract voidappendNoMatch(T builder) Appends a non matching result to a builder created by @link createVectorBuilder}voidclose()protected abstract VectorcreateNoMatchVector(BlockFactory blockFactory, int size) Creates a vector where all positions correspond to elements that don't match the queryprotected abstract TcreateVectorBuilder(BlockFactory blockFactory, int size) Creates the corresponding vector builder to store the results of evaluating the queryexecuteQuery(Page page) protected abstract org.apache.lucene.search.ScoreModeReturns the score mode to use on searches
-
Constructor Details
-
LuceneQueryEvaluator
protected LuceneQueryEvaluator(BlockFactory blockFactory, LuceneQueryEvaluator.ShardConfig[] shards)
-
-
Method Details
-
executeQuery
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.elasticsearch.core.Releasable
-
scoreMode
protected abstract org.apache.lucene.search.ScoreMode scoreMode()Returns the score mode to use on searches -
createNoMatchVector
Creates a vector where all positions correspond to elements that don't match the query -
createVectorBuilder
Creates the corresponding vector builder to store the results of evaluating the query -
appendMatch
protected abstract void appendMatch(T builder, org.apache.lucene.search.Scorable scorer) throws IOException Appends a matching result to a builder created by @link createVectorBuilder}- Throws:
IOException
-
appendNoMatch
Appends a non matching result to a builder created by @link createVectorBuilder}
-