public class QueryRequest extends AbstractPlatformMessage implements LocaleAware, Cloneable, Serializable
When a QueryRequest is sent to AIE, a QueryResponse
will be returned as the result. Use a
SearchClient
for sending QueryRequests to an AIE instance.
The setOffset(long)
and setRows(long)
methods can be
used in order to page through results. Offset indicates the index into the overall result set for the first returned
row. Rows indicates the number of rows that will be returned.
QueryRequest request; // Request the first "page" of 10 results request = new QueryRequest("*:*"); request.setOffset(0); request.setRows(10); // ... (Submit the search and handle response) // Request the second "page" of 10 results request = new QueryRequest("*:*"); request.setOffset(10); request.setRows(10); // ... (Submit the search and handle response)
The setMaxResubmits(int)
method can be used to control automatic query resubmission. A QueryRequest may be
automatically resubmitted to the search engine in case of recoverable error, 0 result response, or other reasons. The
configuration for AIE's query workflows will indicate what resubmission may occur. NOTE: resubmission is disabled by default.
// Allow 1 resubmission QueryRequest request = new QueryRequest("*:*"); request.setMaxResubmits(1); // ... (submit the search and handle response)
The addField(String)
and addField(FieldExpression)
methods can be used to request
specified fields to returned for the matching documents. By default, all stored fields will be returned. NOTE: if you add a
field expression and still want all fields returned in addition to the FieldExpression, you should add the "*" field as well
(see below example). FieldExpression
s allow returning custom fields derived from stored fields (or generated based on
query executed).
QueryRequest request; // Request just the "text" field request = new QueryRequest("*:*"); request.addField("text"); // ... (submit the search and handle response) // Request the "Geo Distance" Field expression (include all stored fields as well) request = new QueryRequest("*:*"); request.addField("*"); // Request all stored fields request.addField(new GeoDistance("position", centerLatitude, centerLongitude)); // ... (submit the search and handle response)
The addBoostQuery(Query)
method allows adding a query to use for boosting purposes. The documents that
match this query will get an additional boost however this boost query will not affect the documents that match this
QueryRequest.
// Match all documents, boosting documents with "foo" in the title higher QueryRequest request = new QueryRequest("*:*"); request.addBoostQuery(new QueryString("title:foo")); // ... (submit the search and handle response)
The addScoreFunction(FieldExpression)
method allows adding function based boosts to documents matching the
QueryRequest.
// Give a static boost to documents based on the indexed value for the "staticboost" field QueryRequest request = new QueryRequest("*:*"); request.addScoreFunction("staticboost"); // ... (submit the search and handle response)
The addSort(Sort)
method allows specifying the sort criteria for the QueryRequest. If no sort criteria is
added, then the QueryRequest will be sorted by score descending. Multiple levels of sorting can be added to perform
tie-breaking in the event that multiple documents have the same value for a sort.
// Sort by "size" ascending QueryRequest request = new QueryRequest("*:*"); request.addSort(new Sort("size", Sort.SortOrder.DESCENDING)); // ... (submit the search and handle response)
The addFacet(FacetRequest[])
and addFacetField(String[])
methods allow requesting
facets to be returned along with the results. There are different types of facets that can be requested for a query. The
simplest will return counts for all discrete values for a facet field (FacetRequest
).
RangeFacetRequest
can be used to return buckets for specified ranges of values.
FilterBasedFacetRequest
can be used to get a bucket count for any arbitrary Query
over the result set.
QueryRequest request = new QueryRequest("*:*"); // request a facet for the author field request.addFacetField("author"); // request a "range" facet with 10 buckets for values between 0 and 1000 request.addFacet(new RangeFacetRequest("size", 0, 1000, 10)); // ... (submit the search and handle response)
The addFilter(Query)
method allows adding filters to the QueryRequest to restrict the matching documents
to those that also match the filter. NOTE: applied filters do not modify the score of the document.
// Filter result set to the "documents" table QueryRequest request = new QueryRequest("*:*"); request.addFilter(new PhraseQuery("table", "documents")); // ... (submit the search and handle response)
WARNING: QueryRequests should not be reused. Reusing a QueryRequest for multiple searches can have adverse effects especially if run inside a single JVM.
Modifier and Type | Class and Description |
---|---|
static class |
QueryRequest.AcronymsMode
Modes for Acronym Expansion.
|
static class |
QueryRequest.FacetFinderMode
Modes for FacetFinder.
|
static class |
QueryRequest.SpellCheckMode
Modes for spell checking.
|
static class |
QueryRequest.StopwordsMode
Modes for Stopword removal
|
static class |
QueryRequest.SynonymsMode
Modes for Synonym Expansion.
|
DEFAULT_MAX_LOG_LENGTH, MESSAGE_DROPPED, MESSAGE_SEND_TIME_PROP, PROP_MAX_LOG_LENGTH
Constructor and Description |
---|
QueryRequest()
The default constructor.
|
QueryRequest(Query query)
Constructor with a
Query . |
QueryRequest(String query)
Constructor with a string query.
|
QueryRequest(String query,
String language)
Constructor with a query string and query language.
|
Modifier and Type | Method and Description |
---|---|
void |
addBoostQuery(Query boost)
Add a boost query.
|
void |
addFacet(FacetRequest... f)
Adds all
FacetRequest s to this QueryRequest. |
void |
addFacetField(String... fieldNames)
Adds a
FacetRequest for all specified fields. |
void |
addFacetFilter(FacetFilter bucket)
Adds a filter to this QueryRequest that will "drill down" on
bucket . |
void |
addField(FieldExpression field)
Add a FieldExpression to return for this QueryRequest.
|
void |
addField(String field)
Add a field to return in the response documents.
|
void |
addFilter(Query f)
Add a filter
Query to this QueryRequest. |
void |
addFilter(String exp)
Add a filter query to this QueryRequest.
|
void |
addFilter(String exp,
String langSpec)
Add a filter query to this QueryRequest.
|
void |
addScoreFunction(FieldExpression... value)
Add a scoring function to this QueryRequest.
|
void |
addScoreFunction(FieldExpression value)
Add a scoring function to this QueryRequest.
|
void |
addScoreFunction(String... value)
Add a scoring function to this QueryRequest.
|
void |
addScoreFunction(String value)
Add a scoring function to this QueryRequest.
|
void |
addSort(FieldExpression field,
Sort.SortOrder order) |
void |
addSort(Sort value)
Add a
Sort specifier to this QueryRequest. |
void |
addSort(String field,
Sort.SortOrder order) |
QueryRequest |
clone()
Clones the object and resets message ID to -1.
|
static QueryRequest |
create(CgiRequest cgi)
Converts CGI HTTP POST/GET request to a
QueryRequest . |
boolean |
equals(Object other) |
int |
getAcronymBoost()
Get the boost to apply to expanded acronyms.
|
String |
getAcronymDictionaryName()
Get the name of the dictionary to use for acronym expansion.
|
QueryRequest.AcronymsMode |
getAcronymsMode()
Get the mode for expanding acronyms.
|
List<Query> |
getBoostQueries()
Get all boost queries applied to this QueryRequest.
|
Date |
getCenterTime() |
List<FacetFilter> |
getFacetFilters()
Get the
FacetFilter s that will be used to filter the result set. |
int |
getFacetFinderCount()
Get the maximum number of facets FacetFinder will add to this QueryRequest.
|
QueryRequest.FacetFinderMode |
getFacetFinderMode()
Get the mode for FacetFinder.
|
List<FacetRequest> |
getFacets()
Get the facets requested for this QueryRequest.
|
int |
getFacetSampleSize()
Get the sample size for sample based facets.
|
FieldCollapse |
getFieldCollapse()
Get the field collapsing specification for this QueryRequest.
|
FieldExpression[] |
getFields()
Get the fields requested for this query (or
null for SELECT *). |
List<Query> |
getFilters()
Get all filters for this query.
|
Point |
getGeoLocation()
Get the default center point for geo distance calculations.
|
String |
getGeoLocationField()
Get the default field to use for geo distance calculations.
|
FieldExpression[] |
getGroupBy()
Get the Group By specification.
|
FieldExpression |
getGroupByFilter()
Experimental: Get the filter to apply to groups.
|
HighlightMode |
getHighlightMode()
Get the
HighlightMode for annotating scopes in highlighted text. |
String |
getHighlightScope()
Get the name of the scope used to annotate matching phrases in highlighted text.
|
JoinFacetMode |
getJoinFacetMode()
Gets the facet mode for joined documents.
|
JoinRollupMode |
getJoinRollupMode()
Gets the rollup mode for joined documents.
|
Locale |
getLocale()
Get the Locale for this query.
|
int |
getMaxResubmits()
Gets the maximum number of resubmits allowed for this QueryRequest.
|
long |
getOffset()
Get the offset into the result set for the first returned document.
|
AttivioPrincipal |
getPrincipal() |
Query |
getQuery()
Get the search query for this QueryRequest.
|
String |
getQueryLanguage()
Get the query language for
getQueryString() . |
String |
getQueryString()
Get the original query string for the search query for this QueryRequest.
|
List<RelevancyFeature> |
getRelevancyFeatures()
Get the features to use for relevancy.
|
RelevancyModel |
getRelevancyModel()
Gets the relevancy model to use for this query.
|
String |
getRelevancyModelName()
Deprecated.
|
String[] |
getRelevancyModelNames()
Get the names of the requested relevancy models.
|
int |
getResubmits()
Get the number of times this QueryRequest has been resubmitted.
|
FieldExpression |
getRowFilter()
Experimental: Get the filter to apply to rows.
|
long |
getRows()
Get the requested number of documents to return for this request.
|
String |
getSchemaName()
Get the name of the schema to use for processing this QueryRequest.
|
List<FieldExpression> |
getScoreFunctions()
Gets the scoring functions to use for this QueryRequest.
|
int |
getSearchDepth()
Get the number of rows deep the search should go.
|
String |
getSearchProfile()
Get the name of the search profile to apply to the query request.
|
long |
getSeed()
Get the seed used for any random functions over this query request.
|
List<Sort> |
getSort()
Get the sorting specification for this QueryRequest.
|
String |
getSpellCheckDictionaryName()
Get the name of the dictionary to use for spellcheck.
|
int |
getSpellCheckExpandSize()
Gets the number of expanded suggestions that will be added for misspelled terms.
|
QueryRequest.SpellCheckMode |
getSpellCheckMode()
Get the mode for spell checking.
|
String |
getStopwordDictionaryName()
Get the name of the dictionary to use for stopword removal.
|
QueryRequest.StopwordsMode |
getStopwordsMode()
Get the mode for stopword removal.
|
int |
getSynonymBoost()
Get the boost to apply to expanded synonyms.
|
String |
getSynonymDictionaryName()
Get the name of the dictionary to use for synonym expansion.
|
QueryRequest.SynonymsMode |
getSynonymsMode()
Get the mode for synonym expansion.
|
TimeZone |
getTimeZone()
Get the TimeZone for this query.
|
Set<String> |
getZones()
Get the names of the zones to apply this query to.
|
boolean |
hasFacets()
true if this QueryRequest is requesting any Facets. |
int |
hashCode() |
void |
incrementResubmits()
Increment the number of times this QueryRequest has been resubmitted.
|
boolean |
isCacheable()
Get if the results for this QueryRequest are cacheable.
|
boolean |
isDebug()
Get if debugging information is desired for this request.
|
boolean |
isHighlight()
true if highlighting should be performed for configured fields. |
boolean |
isIncludeMetadataInResponse()
True if the response should be removed of all non data elements such as message history and the query request.
|
boolean |
isPartialResults()
Gets if partial result is allowed for this request.
|
boolean |
removeFacet(FacetRequest facet)
Remove the specified FacetRequest.
|
boolean |
removeFacet(String facetRequestName)
Remove the specified FacetRequest by name.
|
void |
setAcronymBoost(int acronymBoost)
Set the boost to apply to expanded acronyms.
|
void |
setAcronymDictionaryName(String value)
Set the name of the dictionary to use for acronym expansion.
|
void |
setAcronymsMode(QueryRequest.AcronymsMode acronymsMode)
Set the mode for expanding acronyms.
|
void |
setBoostQueries(List<Query> value)
Set the boost queries.
|
void |
setCacheable(boolean value)
Set if the results for this QueryRequest are cacheable.
|
void |
setCenterTime(Date value) |
void |
setDebug(boolean value)
Set if debugging information is desired for this request.
|
void |
setFacetFilters(List<FacetFilter> facetFilters)
Set the
FacetFilter s to "drill down" on. |
void |
setFacetFinderCount(int facetFinderCount)
Set the maximum number of facets FacetFinder will add to this QueryRequest.
|
void |
setFacetFinderMode(QueryRequest.FacetFinderMode facetFinderMode)
Set the mode for FacetFinder.
|
void |
setFacets(Collection<FacetRequest> facets)
Set the
FacetRequest s for this query |
void |
setFacets(FacetRequest... facets)
Set the
FacetRequest s for this query. |
void |
setFacets(String... facets)
Set the fields to request facets for.
|
void |
setFacetSampleSize(int value)
Set the sample size for sample based facets.
|
void |
setFieldCollapse(FieldCollapse value)
Set the field collapsing specification for this QueryRequest.
|
void |
setFields(Collection<FieldExpression> value)
Set the fields to return for this QueryRequest.
|
void |
setFields(FieldExpression... newFields)
Set the fields to return for this QueryRequest.
|
void |
setFields(String... newFields)
Set the names of the fields that should be returned in the response.
|
void |
setFilters(List<Query> filters)
Set the filter
Query s to apply to this QueryRequest. |
void |
setGroupBy(FieldExpression... columns)
Set the Group By specification.
|
void |
setGroupBy(List<FieldExpression> columns)
Set the Group By specification.
|
void |
setGroupBy(String... columns)
Set the Group By specification.
|
void |
setGroupByFilter(FieldExpression value)
Experimental: Set the filter to apply to groups.
|
void |
setGroupByFilter(String value)
Experimental: Set the filter to apply to groups.
|
void |
setHighlight(boolean value)
Set if highlighting should be performed for configured fields.
|
void |
setHighlightMode(HighlightMode value)
Set the
HighlightMode for annotating scopes in highlighted text. |
void |
setHighlightScope(String value)
Set the name of the scope used to annotate matching phrases in highlighted text.
|
void |
setIncludeMetadataInResponse(boolean includeMetadataInResponse) |
void |
setJoinFacetMode(JoinFacetMode value)
Sets the facet mode for joined documents.
|
void |
setJoinRollupMode(JoinRollupMode value)
Sets the rollup mode for joined documents.
|
void |
setLocale(Locale l)
Set the Locale for this query.
|
void |
setMaxResubmits(int value)
Sets the maximum number of resubmits allowed for this QueryRequest.
|
void |
setOffset(long value)
Set the offset into the result set for the first returned document.
|
void |
setPartialResults(boolean value)
Gets if partial result is allowed for this request.
|
void |
setPrincipal(AttivioPrincipal principal) |
void |
setProperties(Map<String,String[]> parameters) |
void |
setProperty(String name,
Object value)
Sets an arbitrary property for the message.
|
void |
setQuery(Query query)
Set the search query for this QueryRequest.
|
void |
setQuery(String query)
Set the search query for this QueryRequest.
|
void |
setQuery(String queryString,
String language)
Set the search query for this QueryRequest.
|
void |
setQueryString(String query)
Set the search query for this QueryRequest.
|
void |
setRelevancyFeatures(List<RelevancyFeature> value)
Set the features to use for relevancy.
|
void |
setRelevancyFeatures(RelevancyFeature... value)
Set the features to use for relevancy.
|
void |
setRelevancyModel(RelevancyModel model)
Sets the relevancy model to use for this query.
|
void |
setRelevancyModelName(String name)
Deprecated.
Use
setRelevancyModelNames(String...) instead. |
void |
setRelevancyModelNames(List<String> value)
Set the names of the requested relevancy models.
|
void |
setRelevancyModelNames(String... value)
Set the names of the requested relevancy models.
|
void |
setResubmits(int rs)
Set the number of times this QueryRequest has been resubmitted.
|
void |
setRowFilter(FieldExpression value)
Experimental: Set the filter to apply to rows.
|
void |
setRowFilter(String value)
Experimental: Set the filter to apply to rows.
|
void |
setRows(long value)
Set the requested number of documents to return in the
QueryResponse for this request. |
void |
setSchemaName(String schemaName)
Set the name of the schema to use for processing this QueryRequest.
|
void |
setScoreFunctions(List<FieldExpression> value)
Sets the scoring functions to use for this QueryRequest.
|
void |
setSearchDepth(int value)
Set the number of rows deep the search should go.
|
void |
setSearchProfile(String name)
Set the name of the search profile to apply to the query request.
|
void |
setSeed(long value)
Set the seed used for any random functions over this query request.
|
void |
setSort(List<Sort> value)
Set the sorting specification for this QueryRequest.
|
void |
setSort(Sort... value) |
void |
setSpellCheckDictionaryName(String value)
Set the name of the dictionary to use for spellcheck.
|
void |
setSpellCheckExpandSize(int value)
Sets the number of expanded suggestions that will be added for misspelled terms.
|
void |
setSpellCheckMode(QueryRequest.SpellCheckMode spellCheckMode)
Set the mode for spell checking.
|
void |
setStopwordDictionaryName(String value)
Set the name of the dictionary to use for stopword removal.
|
void |
setStopwordsMode(QueryRequest.StopwordsMode stopwordsMode)
Set the mode for stopword removal.
|
void |
setSynonymBoost(int synonymBoost)
Set the boost to apply to expanded synonyms.
|
void |
setSynonymDictionaryName(String value)
Set the name of the dictionary to use for synonym expansion.
|
void |
setSynonymsMode(QueryRequest.SynonymsMode synonymsMode)
Set the mode for synonym expansion.
|
void |
setTimeZone(TimeZone value)
Set the TimeZone for this query.
|
void |
setZones(Set<String> value)
Set the names of the zones to apply this query to.
|
void |
setZones(String... value)
Set the names of the zones to apply this query to.
|
CgiRequest |
toCgiRequest()
Creates a CgiRequest from a QueryRequest.
|
String |
toCgiString()
Returns a parseable CGI string representation of the request
|
protected StringBuilder |
toString(StringBuilder buffer)
Append the string form of this request to
buffer . |
addMessageHistory, addMessageHistory, getClientId, getEstimatedSize, getMessageHistory, getMessageId, getMetadata, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getWorkflowQueue, getWorkflowQueue, hasProperty, isRedelivered, removeProperty, removeWorkflowQueue, setClientId, setMessageId, setRedelivered, setWorkflowQueue, setWorkflowQueue, toMessageString, toString, toString, toString, toString, toString, toString, toString, toString, toString
public static final long DEFAULT_ROWS
getRows()
.public static final long DEFAULT_OFFSET
getOffset()
.public static final boolean DEFAULT_DEBUG
isDebug()
.public static final boolean DEFAULT_INCLUDE_METADATA_IN_RESPONSE
isDebug()
.public static final int DEFAULT_SEARCH_DEPTH
getSearchDepth()
.public static final QueryRequest.StopwordsMode DEFAULT_STOPWORDS_MODE
getStopwordsMode()
.public static final QueryRequest.SynonymsMode DEFAULT_SYNONYM_MODE
getSynonymsMode()
.public static final int DEFAULT_SYNONYM_BOOST
getSynonymBoost()
.public static final QueryRequest.AcronymsMode DEFAULT_ACRONYM_MODE
getAcronymsMode()
.public static final int DEFAULT_ACRONYM_BOOST
getAcronymBoost()
.public static final int DEFAULT_FACET_SAMPLE_SIZE
getFacetSampleSize()
.public static final Locale DEFAULT_LOCALE
getLocale()
.public static final boolean DEFAULT_HIGHLIGHT
isHighlight()
.public static final HighlightMode DEFAULT_HIGHLIGHT_MODE
getHighlightMode()
.public static final String DEFAULT_HIGHLIGHT_SCOPE
getHighlightScope()
.public static final boolean DEFAULT_CACHEABLE
isCacheable()
.public static final QueryRequest.SpellCheckMode DEFAULT_SPELLCHECK_MODE
getSpellCheckMode()
.public static final int DEFAULT_SPELLCHECK_EXPAND_SIZE
getSpellCheckExpandSize()
.public static final int DEFAULT_MAX_RESUBMITS
getMaxResubmits()
.public static final int DEFAULT_RESUBMITS
getResubmits()
.public static final boolean DEFAULT_PARTIAL_RESULTS
isPartialResults()
public static final long DEFAULT_SEED
getSeed()
.public static final QueryRequest.FacetFinderMode DEFAULT_FACET_FINDER_MODE
getFacetFinderMode()
.public static final int DEFAULT_FACET_FINDER_COUNT
getFacetFinderCount()
.public static final JoinRollupMode DEFAULT_JOIN_ROLLUP_MODE
getJoinRollupMode()
.public static final JoinFacetMode DEFAULT_JOIN_FACET_MODE
getJoinFacetMode()
.public static final String SPELLCHECK_MODE_DEFAULT
public QueryRequest()
public QueryRequest(String query)
QueryString
public QueryRequest(String query, String language)
QueryString
public boolean isDebug()
public void setDebug(boolean value)
public long getRows()
public void setRows(long value)
QueryResponse
for this request.
Only values < Integer.MAX_VALUE are supported.
public long getOffset()
public void setOffset(long value)
Currently only values < Integer.MAX_VALUE are supported.
public boolean isIncludeMetadataInResponse()
public void setIncludeMetadataInResponse(boolean includeMetadataInResponse)
public String getSearchProfile()
public void setSearchProfile(String name)
public Query getQuery()
public void setQuery(Query query)
public void setQuery(String query)
QueryString
public void setQueryString(String query)
QueryString
public void setQuery(String queryString, String language)
QueryString
public String getQueryString()
Query.getQueryString()
public String getQueryLanguage()
getQueryString()
.Query.getQueryLanguage()
public int getSearchDepth()
Get the number of rows deep the search should go. When using Field Collapsing, increasing this setting increases the accuracy of Field Collapsing across multiple partitions by giving the collapsing algorithm more rows to collapse. There are no other scenarios where this parameter has any effect.
By default, the search depth will be
.
getOffset()
+ getRows()
NOTE: this does not affect the number of documents returned.
public void setSearchDepth(int value)
Set the number of rows deep the search should go. When using Field Collapsing, increasing this setting increases the accuracy of Field Collapsing across multiple partitions by giving the collapsing algorithm more rows to collapse. There are no other scenarios where this parameter has any effect.
By default, the search depth will be
.
getOffset()
+ getRows()
NOTE: this does not affect the number of documents returned.
public void addBoostQuery(Query boost)
NOTE: Boost queries are only used for ranking, not matching records.
public List<Query> getBoostQueries()
public void setFilters(List<Query> filters)
Query
s to apply to this QueryRequest.public void addFilter(String exp)
public void addFilter(String exp, String langSpec)
exp
- the query to filter onlangSpec
- the query language for exp
public List<FacetFilter> getFacetFilters()
FacetFilter
s that will be used to filter the result set.public void setFacetFilters(List<FacetFilter> facetFilters)
FacetFilter
s to "drill down" on.public void addFacetFilter(FacetFilter bucket)
bucket
.public void setZones(String... value)
public boolean isCacheable()
public void setCacheable(boolean value)
public long getSeed()
This seed will be used when a "random" sort is applied to this QueryRequest.
public void setSeed(long value)
This seed will be used when a "random" sort is applied to this QueryRequest.
public JoinRollupMode getJoinRollupMode()
This setting is only relevant if the search query is a JOIN query.
public void setJoinRollupMode(JoinRollupMode value)
This setting is only relevant if the search query is a JOIN query.
public JoinFacetMode getJoinFacetMode()
This setting is only relevant if the search query contains JOIN queries.
public void setJoinFacetMode(JoinFacetMode value)
This setting is only relevant if the search query contains JOIN queries.
public RelevancyModel getRelevancyModel()
public void setRelevancyModel(RelevancyModel model)
public String[] getRelevancyModelNames()
The first relevancy model that exists will be applied during query processing.
public void setRelevancyModelNames(List<String> value)
The first relevancy model that exists will be applied during query processing.
public void setRelevancyModelNames(String... value)
The first relevancy model that exists will be applied during query processing.
@Deprecated public String getRelevancyModelName()
@Deprecated public void setRelevancyModelName(String name)
setRelevancyModelNames(String...)
instead.With default configurations, this can be set to "noop" in order to apply an empty relevancy model.
public boolean isPartialResults()
public void setPartialResults(boolean value)
public List<RelevancyFeature> getRelevancyFeatures()
public void setRelevancyFeatures(List<RelevancyFeature> value)
public void setRelevancyFeatures(RelevancyFeature... value)
public List<FieldExpression> getScoreFunctions()
public void setScoreFunctions(List<FieldExpression> value)
public void addScoreFunction(String value)
public void addScoreFunction(String... value)
public void addScoreFunction(FieldExpression value)
public void addScoreFunction(FieldExpression... value)
public int getMaxResubmits()
public void setMaxResubmits(int value)
public int getResubmits()
public void setResubmits(int rs)
NOTE: this method should only be used by QueryResponse Transformers that will perform resubmit logic.
public void incrementResubmits()
NOTE: this method should only be used by QueryResponse Transformers that will perform resubmit logic.
public List<Sort> getSort()
If null
or "empty", then sorting will be done by score descending.
public void setSort(Sort... value)
public void setSort(List<Sort> value)
If null
or "empty", then sorting will be done by score descending.
public void addSort(String field, Sort.SortOrder order)
public void addSort(FieldExpression field, Sort.SortOrder order)
public int getFacetSampleSize()
public void setFacetSampleSize(int value)
public boolean hasFacets()
true
if this QueryRequest is requesting any Facets.public List<FacetRequest> getFacets()
public void setFacets(String... facets)
NOTE: overwrites any FacetRequest
s already set.
public void setFacets(FacetRequest... facets)
FacetRequest
s for this query.
NOTE: overwrites any FacetRequests already set
public void setFacets(Collection<FacetRequest> facets)
FacetRequest
s for this query
NOTE: overwrites any FacetRequest
s already set.
public void addFacet(FacetRequest... f)
FacetRequest
s to this QueryRequest.public void addFacetField(String... fieldNames)
FacetRequest
for all specified fields.public boolean removeFacet(FacetRequest facet)
public boolean removeFacet(String facetRequestName)
public boolean isHighlight()
true
if highlighting should be performed for configured fields.public void setHighlight(boolean value)
public HighlightMode getHighlightMode()
HighlightMode
for annotating scopes in highlighted text.public void setHighlightMode(HighlightMode value)
HighlightMode
for annotating scopes in highlighted text.public String getHighlightScope()
public void setHighlightScope(String value)
public FieldExpression[] getFields()
null
for SELECT *).public void setFields(Collection<FieldExpression> value)
public void setFields(FieldExpression... newFields)
public void setFields(String... newFields)
null
for SELECT *).
NOTE: if isHighlight() returns true, then any field in fields
that is configured in the schema
for highlighting will be returned highlighted according to schema configuration.
Use addField(FieldExpression)
to add FieldExpression
s configured as desired.
public void addField(String field)
public void addField(FieldExpression field)
public FieldCollapse getFieldCollapse()
public void setFieldCollapse(FieldCollapse value)
public FieldExpression getGroupByFilter()
This allows applying a HAVING filter to the result set.
This filter requires that a groupby
has been
applied to the query.
public void setGroupByFilter(FieldExpression value)
public void setGroupByFilter(String value)
public FieldExpression getRowFilter()
This allows applying a field expression based WHERE filter to the result set.
public void setRowFilter(FieldExpression value)
public void setRowFilter(String value)
public FieldExpression[] getGroupBy()
public void setGroupBy(String... columns)
public void setGroupBy(FieldExpression... columns)
public void setGroupBy(List<FieldExpression> columns)
public QueryRequest.SpellCheckMode getSpellCheckMode()
public void setSpellCheckMode(QueryRequest.SpellCheckMode spellCheckMode)
public String getSpellCheckDictionaryName()
public void setSpellCheckDictionaryName(String value)
public int getSpellCheckExpandSize()
NOTE: this setting will only be used if the AUTO_EXPAND spell check mode is used.
public void setSpellCheckExpandSize(int value)
NOTE: this setting will only be used if the AUTO_EXPAND spell check mode is used.
public QueryRequest.AcronymsMode getAcronymsMode()
public void setAcronymsMode(QueryRequest.AcronymsMode acronymsMode)
public String getAcronymDictionaryName()
public void setAcronymDictionaryName(String value)
public int getAcronymBoost()
public void setAcronymBoost(int acronymBoost)
This can be used to reduce or nullify the boost contributed by acronyms in order to utilize acronym expansion for increasing recall.
public QueryRequest.SynonymsMode getSynonymsMode()
public void setSynonymsMode(QueryRequest.SynonymsMode synonymsMode)
public String getSynonymDictionaryName()
public void setSynonymDictionaryName(String value)
public int getSynonymBoost()
public void setSynonymBoost(int synonymBoost)
This can be used to reduce or nullify the boost contributed by synonyms in order to utilize synonym expansion for increasing recall.
public QueryRequest.StopwordsMode getStopwordsMode()
public void setStopwordsMode(QueryRequest.StopwordsMode stopwordsMode)
public String getStopwordDictionaryName()
public void setStopwordDictionaryName(String value)
public QueryRequest.FacetFinderMode getFacetFinderMode()
public void setFacetFinderMode(QueryRequest.FacetFinderMode facetFinderMode)
public int getFacetFinderCount()
public void setFacetFinderCount(int facetFinderCount)
public Locale getLocale()
getLocale
in interface LocaleAware
public void setLocale(Locale l)
In general a correct value for the Locale is required in order to perform proper query side linguistics.
setLocale
in interface LocaleAware
public Date getCenterTime()
This center time will be used as the "current time" for all evaluated field expressions (such as CurrentTime
)
public void setCenterTime(Date value)
This center time will be used as the "current time" for all evaluated field expressions (such as CurrentTime
)
public TimeZone getTimeZone()
public void setTimeZone(TimeZone value)
public String getSchemaName()
public void setSchemaName(String schemaName)
protected StringBuilder toString(StringBuilder buffer)
buffer
.toString
in class AbstractPlatformMessage
public CgiRequest toCgiRequest()
QueryRequest
create method.
Not all queries and filters are guaranteed to have equivalent parseable string
representations; this method cannot guarantee an equivalent CGI Request
for such cases.public String toCgiString()
public int hashCode()
hashCode
in class AbstractPlatformMessage
public boolean equals(Object other)
equals
in class AbstractPlatformMessage
public QueryRequest clone()
clone
in interface PlatformMessage
clone
in class AbstractPlatformMessage
public String getGeoLocationField()
public Point getGeoLocation()
public void setProperties(Map<String,String[]> parameters) throws AttivioException
AttivioException
public void setProperty(String name, Object value)
AbstractPlatformMessage
setProperty
in interface PlatformMessage
setProperty
in class AbstractPlatformMessage
name
- the keyvalue
- the valuepublic static QueryRequest create(CgiRequest cgi) throws AttivioException
QueryRequest
.
Parameter | Type(1) | Default | Multi(2) | Description | Example |
---|---|---|---|---|---|
clientid | String | optional | no | Client ID. | clientid=1234 |
workflows | String | required | no | Comma separated list of workflows to send the query through. | workflows=defaultQuery,searcher,defaultResponse |
q | String | required | no | Query String | q=cat |
q.type | String | advanced |
no | Query Language used. [ simple | advanced ] |
q.type=simple |
filter | String | optional | yes | Filter Query to apply. |
filter=position:POLYGON((5.0, 9.0), (5.0, 11.0), (6.0, 11.0), (6.0, 9.0)) |
q.filter | String | optional | yes | Query Filter. | q.filter=color:black |
q.filter.type | String | simple |
no | Deprecated. Query Language used by filter. [ simple | advanced ] |
q.filter.type=advanced |
q.boost | String | optional | yes | Query Boost Expression | q.boost=foo |
q.boost.type | String | advanced |
no | Query Language used by query boosts. [ simple | advanced ] |
q.boost.type=advanced |
q.maxResubmits | unsigned | 0 | no | Maximum number of times query can be resubmitted. | q.maxResubmits=5 |
hits | unsigned | 10L | no | Number of records to return. | hits=100 |
offset | unsigned | 0L | no | Retrieve number of records starting from offset. | offset=20 |
searchDepth | unsigned | 0 | no | Number of rows deep to search. | searchDepth=100 |
searchProfile | String | optional | no | Name of the search profile to use. | searchProfile=mySearchProfile |
debug | boolean | false | no | Enable debugging information. true or false | debug=true |
includeMetadataInResponse | boolean | false | no | Include non essential/data (from the index) information in the response. true or false | debug=true |
partialResults | boolean | false | no | Enable/Disable partial results from distributed indexes | partialResults=false |
abc.enabled | boolean | false | no | Whether or not the query should be annotated as an Attivio Business Center query. | abc.enabled=true |
cacheable | boolean | true | no | Is the result cacheable? | cacheable=false |
seed | long | 0L | no | Seed to use for random number generation (random sorting, etc) | seed=38293843928 |
locale | String | en | no | 2 letter iso code for locale. | locale=en |
timezone | String | UTC | no | Time Zone for date interpretation. | timezone=EST |
schema | String | optional | no | Name of the schema to use for query processing | schema=default |
relevancymodelname | String | optional | no | Comma separated list of relevancy model names to use for ranking documents by relevancy. The first relevancy model specified that exists will be used. | relevancyModelName=myTestModel |
highlight | boolean | false | no | highlight results based on schema configuration | highlight=true |
fields | String | optional | yes | Comma separated list of field expressions to return with response documents. | fields=*,geodistance(position, 72.3, 71.5, degrees, miles) AS distance |
sort | String | optional | no | Comma separated list of fields to sort by [ ASC | DESC ] | sort=title:asc,body:desc |
score.function | String | optional | yes | Score function to boost matching documents with | score.function=product(sum(5.5, boostfield), boostfactorfield) |
collapse | String | optional | no | Field collapsing specification. | Example: collapse=cat(mode=2D, rows=10) |
facet | String | optional | yes | Comma separated list of discrete facet definitions. | Example: facet=title(mincutoff=3,sortby=count),category(maxnumbuckets=100) |
facet.filter | String | optional | no | Facet bucket to use for filtering results. | Example: facet.filter=department:"Sales Engineering" |
rangeFacet | String | optional | yes | Comma separated list of range facet definitions. | rangeFacet=size(range=int("label-1", 0, 5),range=int("label-2", 5, 10)) |
rangeFacet.filter | String | optional | no | Range Facet bucket to use for filtering results. | Example: rangeFacet.filter=size:[0 TO 50] |
schemaFacet | String | optional | yes | Schema facet definition | schemaFacet=schema(schemaFields=true) |
facet.ff | enum | OFF |
no | Facet finder mode.
[ OFF | RESULTS ] |
facet.ff=RESULTS |
facet.ffcount | unsigned | 3 | no | Limit the number of facets returned by Facet Finder service | facet.ffcount=4 |
join.rollup | enum | AGGREGATE |
no | Join children aggregation mode.
[ AGGREGATE | TREE ] |
join.rollup=TREE |
join.facet | enum | DISTINCT |
no | Join children facet aggregation mode.
[ DISTINCT | FULL ] |
join.facet=FULL |
l.stopwords.mode | enum | OFF |
no | Enable stop word removal.
[ OFF | REMOVE | BLOCK ] |
l.stopwords.mode=off |
l.acronym.dictionary | String | optional | no | Name of the acronym dictionary to use. | l.acronym.dictionary=myAcronymDictionary |
l.acronyms.mode | enum | OFF |
no | Enable acronym expansion.
[ OFF | ON | AUTO ] |
l.acronyms.mode=off |
l.acronyms.boost | int | 100 | no | Set boost for expanded acronyms. | l.acronyms.boost=25 |
l.synonym.dictionary | String | optional | no | Name of the synonym dictionary to use. | l.synonym.dictionary=mySynonymDictionary |
l.synonyms.mode | enum | OFF |
no | Enable synonyms.
[ OFF | ON | AUTO ] |
l.synoynms.mode=off |
l.synonymBoost | int | 100 | no | set synonym boost or down weight. | l.synoynmBoost=25 |
l.spell.mode | enum | OFF |
no | Spelling Correction Mode.
[ OFF | SUGGEST |
AUTOCORRECT | AUTOEXPAND ]
|
l.spell.mode=SUGGEST |
l.spellexpandsize | unsigned | 2 | no | Sets the number of expanded suggestions that will be added for misspelled terms. | l.spellexpandsize=2 |
geo.field | String | optional | no | The default field to use for geo search. | geo.field=position |
geo.latitude | double | optional | no | The default latitude of center point for geo search. | geo.latitude=0 |
geo.longitude | double | optional | no | The default longitude of center point for geo search. | geo.longitude=0 |
geo.distanceUnits | enum | KILOMETERS |
no | The units distances are specified.
[ KILOMETERS |
METERS |
MILES |
YARDS |
NAUTICAL_MILES ]
|
geo.distanceUnits=MILES |
any unknown parameter | String | optional | optional | All unknown cgi parameters are set as message properties via setProperty(String, Object) .
These properties can then be used by custom transformers or accessed in cgi query logs for reporting purposes. |
myProp=myValue |
(1) The Type column indicates the data type expected for values of the query parameter. If values are specified that are not of this type, the default value will be used instead, unless the parameter is optional, in which case the parameter will be ignored.
(2) The Multi column indicates whether or not the HTTP query parameter can be specified multiple times. For example, since the q.filter parameter is Multi=yes, you can specify it mulitiple times like so q.filter=filter1&q.filter=filter2
.
cgi
- - CGI request objectAttivioException
public void setPrincipal(AttivioPrincipal principal)
public AttivioPrincipal getPrincipal()
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.