public abstract class QueryTraverser extends Object implements LocaleAware
NOTE: This class is not thread safe.
Constructor and Description |
---|
QueryTraverser() |
Modifier and Type | Method and Description |
---|---|
protected Locale |
getDefaultLocale()
Get the default locale to return for
getLocale() . |
Locale |
getLocale()
Gets the local associated with this object or null if not set.
|
Object |
getParameter(String name)
Gets a named property from the query.
|
boolean |
getParameter(String name,
boolean defaultValue)
Gets the boolean property for this QueryStack.
|
double |
getParameter(String name,
double defaultValue)
Gets a named double property for this QueryStack.
|
float |
getParameter(String name,
float defaultValue)
Gets a named float property for this QueryStack.
|
int |
getParameter(String name,
int defaultValue)
Gets a named integer property for this QueryStack.
|
Locale |
getParameter(String name,
Locale defaultValue)
Gets a named Locale property for this QueryStack.
|
Object |
getParameter(String name,
Object defaultValue)
Gets a parameter for this QueryStack.
|
String |
getParameter(String name,
String defaultValue)
Gets a named String property for this QueryStack.
|
boolean |
isExcluded()
Returns true if the number of containing NOT operators is odd.
|
void |
rewrite(FieldExpression... fields)
Recursively rewrite any queries in
fields . |
void |
rewrite(FieldExpression field)
Recursively rewrite any queries in
field . |
void |
rewrite(List<Query> queries) |
Query |
rewrite(Query query)
Recursively rewrite
query . |
void |
rewriteAll(QueryRequest request)
Recursively rewrite all queries in
request using this traverser. |
protected Query |
rewriteChildren(Query query,
QueryHandler defaultHandler)
Called to recursively rewrite children of
query . |
void |
rewriteFacets(Collection<FacetRequest> facets)
Rewrite any embedded queries in
facets using handler . |
void |
rewriteFilters(QueryRequest request)
Recursively rewrite all filter queries in
request using this traverser. |
protected Query |
rewriteQuery(Query query)
Callback method called prior to traversing the children of
query . |
protected Query |
rewriteTree(Query query,
QueryHandler defaultHandler)
Called to recursively rewrite a top level
query . |
void |
setLocale(Locale locale)
Sets the local associated with this object.
|
public boolean isExcluded()
public String getParameter(String name, String defaultValue)
name
- the parameterdefaultValue
- the default valuepublic float getParameter(String name, float defaultValue)
name
- the parameterdefaultValue
- the default valuepublic Locale getParameter(String name, Locale defaultValue)
name
- the parameterdefaultValue
- the default valuepublic double getParameter(String name, double defaultValue)
name
- the parameterdefaultValue
- the default valuepublic int getParameter(String name, int defaultValue)
name
- the parameterdefaultValue
- the default valuepublic boolean getParameter(String name, boolean defaultValue)
name
- the parameterdefaultValue
- the default valuepublic Object getParameter(String name, Object defaultValue)
name
- the parameterdefaultValue
- the default valuepublic Locale getLocale()
getLocale
in interface LocaleAware
protected Locale getDefaultLocale()
getLocale()
.public void setLocale(Locale locale)
setLocale
in interface LocaleAware
public final void rewrite(FieldExpression field)
field
.public final void rewriteAll(QueryRequest request)
request
using this traverser.
WARNING: do not use this method unless you are sure you want to modify absolutely all queries in request
.
This method rewrites all queries in:
QueryRequest.getQuery()
,
QueryRequest.getBoostQueries()
, QueryRequest.getFilters()
,
QueryRequest.getFields()
, QueryRequest.getFacets()
.
public final void rewriteFilters(QueryRequest request)
request
using this traverser.
This method rewrites all queries in:
QueryRequest.getFilters()
, QueryRequest.getFacets()
.
public final void rewrite(FieldExpression... fields)
fields
.public final void rewriteFacets(Collection<FacetRequest> facets)
facets
using handler
.protected Query rewriteQuery(Query query)
query
.protected Query rewriteTree(Query query, QueryHandler defaultHandler)
query
.protected Query rewriteChildren(Query query, QueryHandler defaultHandler)
query
.
Override this method to provide custom traversal of children.
Copyright © 2018 Attivio, Inc. All Rights Reserved.
PATENT NOTICE: Attivio, Inc. Software Related Patents. With respect to the Attivio software product(s) being used, the following patents apply: Querying Joined Data Within A Search Engine Index: United States Patent No.(s): 8,073,840. Ordered Processing of Groups of Messages: U.S. Patent No.(s) 8,495,656. Signal processing approach to sentiment analysis for entities in documents: U.S. Patent No.(s) 8,725,494. Other U.S. and International Patents Pending.