public class TermFilteredPresearcher extends Presearcher
QueryVisitor
API can be configured by passing
a list of CustomQueryHandler
implementations.
Filtering by additional fields can be configured by passing a set of field names.
Documents that contain values in those fields will only be checked against
MonitorQuery
instances that have the same fieldname-value mapping in
their metadata.Modifier and Type | Class and Description |
---|---|
protected class |
TermFilteredPresearcher.BytesRefHashIterator
Implements a
BytesRefIterator over a BytesRefHash |
protected static interface |
TermFilteredPresearcher.DocumentQueryBuilder
Constructs a document disjunction from a set of terms
|
Modifier and Type | Field and Description |
---|---|
static TermWeightor |
DEFAULT_WEIGHTOR
The default TermWeightor, weighting by token length
|
NO_FILTERING
Constructor and Description |
---|
TermFilteredPresearcher()
Creates a new TermFilteredPresearcher using the default term weighting
|
TermFilteredPresearcher(TermWeightor weightor,
List<CustomQueryHandler> customQueryHandlers,
Set<String> filterFields)
Creates a new TermFilteredPresearcher
|
Modifier and Type | Method and Description |
---|---|
Query |
buildQuery(LeafReader reader,
BiPredicate<String,BytesRef> termAcceptor)
Build a query for a Monitor's queryindex from a LeafReader over a set of documents to monitor.
|
protected Document |
buildQueryDocument(QueryTree querytree)
Builds a
Document from the terms extracted from a query |
protected Map<String,BytesRefHash> |
collectTerms(QueryTree querytree)
Collects terms from a
QueryTree and maps them per-field |
protected TermFilteredPresearcher.DocumentQueryBuilder |
getQueryBuilder()
Returns a
TermFilteredPresearcher.DocumentQueryBuilder for this presearcher |
Document |
indexQuery(Query query,
Map<String,String> metadata)
Build a lucene Document to index the query in a Monitor's queryindex
|
public static final TermWeightor DEFAULT_WEIGHTOR
public TermFilteredPresearcher()
public TermFilteredPresearcher(TermWeightor weightor, List<CustomQueryHandler> customQueryHandlers, Set<String> filterFields)
weightor
- the TermWeightorcustomQueryHandlers
- A list of custom query handlers to extract terms from non-core queriesfilterFields
- A set of fields to filter onpublic final Query buildQuery(LeafReader reader, BiPredicate<String,BytesRef> termAcceptor)
Presearcher
buildQuery
in class Presearcher
reader
- a LeafReader
over the input documentstermAcceptor
- a predicate indicating if a term should be added to the queryprotected TermFilteredPresearcher.DocumentQueryBuilder getQueryBuilder()
TermFilteredPresearcher.DocumentQueryBuilder
for this presearcherpublic final Document indexQuery(Query query, Map<String,String> metadata)
Presearcher
indexQuery
in class Presearcher
query
- the Query to indexmetadata
- a Map of arbitrary query metadataprotected Document buildQueryDocument(QueryTree querytree)
Document
from the terms extracted from a queryprotected Map<String,BytesRefHash> collectTerms(QueryTree querytree)
QueryTree
and maps them per-fieldCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.