public class IndexQueryEngine extends ScanningQueryEngine
QueryEngine
implementation that uses available indexes to more quickly produce query results.
This query engine is capable of producing results for a query by scanning all nodes in the workspace(s) and filtering out any node that does not satisfy the criteria. This scanning is not very efficient and can result in slow queries, especially when the repository is quite large or when the number of nodes that satisfies the query's criteria is a small fraction of all possible nodes in the workspace(s).
This engine can use indexes for certain properties so that it can more quickly identify the nodes that have property values satisfying the constraints of a query. It is possible to index all properties, but this requires significant space and evaluating all constraints using indexes may actually not be the most efficient and fastest approach. This query engine attempts to use a minimum number of indexes that will most quickly produce the set of nodes closest to the actual expected results.
Indexes are access from the repository's IndexProvider
instances.
Modifier and Type | Class and Description |
---|---|
static class |
IndexQueryEngine.Builder |
protected static class |
IndexQueryEngine.ProviderIndexPlanner
A
IndexPlanner implementation that passes through only those indexes that are owned by the named provider. |
ScanningQueryEngine.DynamicOperandFilter, ScanningQueryEngine.PropertyValueExtractor, ScanningQueryEngine.ResultColumns, ScanningQueryEngine.RowFilterSupplier
Modifier and Type | Field and Description |
---|---|
protected static boolean |
DEBUG |
protected static Logger |
LOGGER
We don't use the standard logging convention here; we want clients to easily configure logging for the indexes
|
protected static boolean |
TRACE |
optimizer, planner, repositoryName
Modifier | Constructor and Description |
---|---|
protected |
IndexQueryEngine(ExecutionContext context,
String repositoryName,
Planner planner,
Optimizer optimizer,
IndexManager indexManager) |
Modifier and Type | Method and Description |
---|---|
static IndexQueryEngine.Builder |
builder()
Obtain a builder that can be used to create new query engine instances.
|
protected NodeSequence |
createNodeSequenceForSource(QueryCommand originalQuery,
QueryContext context,
PlanNode sourceNode,
IndexPlan indexPlan,
QueryResults.Columns columns,
QuerySources sources)
Create a node sequence for the given index
|
checkUnionCompatible, createExtractFromRow, createExtractFromRow, createExtractReferencesFromRow, createNodeSequence, createNodeSequenceForSource, createQueryContext, createRowFilter, createSortingExtractor, createSortingExtractor, determineProjectedColumns, determineType, execute, executeOptimizedQuery, literalValue, literalValues, shutdown, toRegularExpression, toWildcardExpression
protected static final Logger LOGGER
protected static final boolean TRACE
protected static final boolean DEBUG
protected IndexQueryEngine(ExecutionContext context, String repositoryName, Planner planner, Optimizer optimizer, IndexManager indexManager)
public static IndexQueryEngine.Builder builder()
protected NodeSequence createNodeSequenceForSource(QueryCommand originalQuery, QueryContext context, PlanNode sourceNode, IndexPlan indexPlan, QueryResults.Columns columns, QuerySources sources)
ScanningQueryEngine
createNodeSequenceForSource
in class ScanningQueryEngine
originalQuery
- the original query command; may not be nullcontext
- the context in which the query is to be executed; may not be nullsourceNode
- the PlanNode.Type.SOURCE
plan node for one part of a query; may not be nullindexPlan
- the IndexPlan
specification; may not be nullcolumns
- the result column definition; may not be nullsources
- the query sources for the repository; may not be nullCopyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.