public class RegexpQueryHandler extends Object implements CustomQueryHandler
This implementation will filter out more wildcard queries than TermFilteredPresearcher, at the expense of longer document build times. Which one is more performant will depend on the type and number of queries registered in the Monitor, and the size of documents to be monitored. Profiling is recommended.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_TOKEN_SIZE
The default maximum length of an input token before ANYTOKENS are generated
|
static String |
DEFAULT_NGRAM_SUFFIX
The default suffix with which to mark ngrams
|
static String |
DEFAULT_WILDCARD_TOKEN
The default token to emit if a term is longer than MAX_TOKEN_SIZE
|
Constructor and Description |
---|
RegexpQueryHandler()
Creates a new RegexpQueryHandler using default settings
|
RegexpQueryHandler(int maxTokenSize)
Creates a new RegexpQueryHandler with a maximum token size
|
RegexpQueryHandler(String ngramSuffix,
int maxTokenSize,
String wildcardToken,
Set<String> excludedFields)
Creates a new RegexpQueryHandler
|
Modifier and Type | Method and Description |
---|---|
QueryTree |
handleQuery(Query q,
TermWeightor termWeightor)
Builds a
QueryTree node from a query |
TokenStream |
wrapTermStream(String field,
TokenStream ts)
Adds additional processing to the
TokenStream over a document's
terms index |
public static final String DEFAULT_NGRAM_SUFFIX
public static final int DEFAULT_MAX_TOKEN_SIZE
public static final String DEFAULT_WILDCARD_TOKEN
public RegexpQueryHandler(String ngramSuffix, int maxTokenSize, String wildcardToken, Set<String> excludedFields)
ngramSuffix
- the suffix with which to mark ngramsmaxTokenSize
- the maximum length of an input token before WILDCARD tokens are generatedwildcardToken
- the token to emit if a token is longer than maxTokenSize in lengthexcludedFields
- a Set of fields to ignore when generating ngramspublic RegexpQueryHandler()
public RegexpQueryHandler(int maxTokenSize)
maxTokenSize
- the maximum length of an input token before WILDCARD tokens are generatedpublic TokenStream wrapTermStream(String field, TokenStream ts)
CustomQueryHandler
TokenStream
over a document's
terms indexwrapTermStream
in interface CustomQueryHandler
public QueryTree handleQuery(Query q, TermWeightor termWeightor)
CustomQueryHandler
QueryTree
node from a queryhandleQuery
in interface CustomQueryHandler
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.