Package redis.clients.jedis.search
Class Query
java.lang.Object
redis.clients.jedis.search.Query
- All Implemented Interfaces:
IParams
Query represents query parameters and filters to load results from the engine
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFilter represents a filtering rules in a querystatic classGeoFilter encapsulates a radius filter on a geographical indexed fieldsstatic classstatic classNumericFilter wraps a range filter on a numeric field.static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate Stringprivate String[]private final List<Query.Filter> The query's filter list.private booleanprivate String[]private Stringprivate booleanprivate booleanprivate final Query.PagingThe sorting parametersprivate byte[]private final StringThe textual part of the queryprivate String[]private Stringprivate intprivate booleanprivate Stringprivate longprivate booleanprivate booleanprivate booleanprivate String[]private String[]private FieldName[]private String[]private intprivate intprivate Stringprivate booleanprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a filter to the query's filter listParameters can be referenced in the query string by a $ , followed by the parameter name, e.g., $user , and each such reference in the search query to a parameter name is substituted by the corresponding parameter value.voidaddParams(CommandArguments args) dialect(int dialect) Set the dialect version to execute the query accordinglybooleanbooleanDeprecated.booleanhighlightFields(String... fields) highlightFields(Query.HighlightTags tags, String... fields) Limit the results to a certain offset and limitlimitFields(String... fields) Limit the query to results that are limited to a specific set of fieldsLimit the query to results that are limited to a specific set of keysreturnFields(String... fields) Result's projection - the fields to return by the queryreturnFields(FieldName... fields) Result's projection - the fields to return by the querysetExpander(String field) Set the query to use a custom query expander instead of the stemmerSet the query terms appear in the same order in the document as in the query, regardless of the offsets between themsetLanguage(String language) Set the query language, for stemming purposesSet the query not to return the contents of documents, and rather just return the idsSet the query not to filter for stopwords.setPayload(byte[] payload) Deprecated.Since RediSearch 2.0.0, PAYLOAD option is deprecated.Set the query custom scorerSet the query to be sorted by a Sortable field defined in the schemaSet the query to verbatim mode, disabling stemming and query expansionDeprecated.Since RediSearch 2.0.0, WITHPAYLOADS option is deprecated.Set the query to return a factored score for each results.slop(int slop) Set the slop to execute the query accordinglysummarizeFields(int contextLen, int fragmentCount, String separator, String... fields) summarizeFields(String... fields) timeout(long timeout) Set the timeout to execute the query accordingly
-
Field Details
-
_filters
The query's filter list. We only support AND operation on all those filters -
_queryString
The textual part of the query -
_paging
The sorting parameters -
_verbatim
private boolean _verbatim -
_noContent
private boolean _noContent -
_noStopwords
private boolean _noStopwords -
_withScores
private boolean _withScores -
_withPayloads
private boolean _withPayloads -
_language
-
_fields
-
_keys
-
_returnFields
-
returnFieldNames
-
highlightFields
-
summarizeFields
-
highlightTags
-
summarizeSeparator
-
summarizeNumFragments
private int summarizeNumFragments -
summarizeFragmentLen
private int summarizeFragmentLen -
_payload
private byte[] _payload -
_sortBy
-
_sortAsc
private boolean _sortAsc -
wantsHighlight
private boolean wantsHighlight -
wantsSummarize
private boolean wantsSummarize -
_scorer
-
_params
-
_dialect
private int _dialect -
_slop
private int _slop -
_timeout
private long _timeout -
_inOrder
private boolean _inOrder -
_expander
-
-
Constructor Details
-
Query
public Query() -
Query
Create a new index- Parameters:
queryString- the textual part of the query
-
-
Method Details
-
addParams
-
limit
Limit the results to a certain offset and limit- Parameters:
offset- the first result to show, zero based indexinglimit- how many results we want to show- Returns:
- the query itself, for builder-style syntax
-
addFilter
Add a filter to the query's filter list- Parameters:
f- either a numeric or geo filter object- Returns:
- the query itself
-
setPayload
Deprecated.Since RediSearch 2.0.0, PAYLOAD option is deprecated.Set the query payload to be evaluated by the scoring function- Returns:
- the query object itself
-
setVerbatim
Set the query to verbatim mode, disabling stemming and query expansion- Returns:
- the query object
-
getNoContent
public boolean getNoContent() -
setNoContent
Set the query not to return the contents of documents, and rather just return the ids- Returns:
- the query itself
-
setNoStopwords
Set the query not to filter for stopwords. In general this should not be used- Returns:
- the query object
-
getWithScores
public boolean getWithScores() -
setWithScores
Set the query to return a factored score for each results. This is useful to merge results from multiple queries.- Returns:
- the query object itself
-
getWithPayloads
Deprecated. -
setWithPayload
Deprecated.Since RediSearch 2.0.0, WITHPAYLOADS option is deprecated.Set the query to return object payloads, if any were given- Returns:
- the query object itself
-
setLanguage
Set the query language, for stemming purposesSee http://redisearch.io for documentation on languages and stemming
- Parameters:
language- a language.- Returns:
- the query object itself
-
setScorer
Set the query custom scorerSee http://redisearch.io for documentation on extending RediSearch
- Parameters:
scorer- a custom scorer.- Returns:
- the query object itself
-
limitFields
Limit the query to results that are limited to a specific set of fields- Parameters:
fields- a list of TEXT fields in the schemas- Returns:
- the query object itself
-
limitKeys
Limit the query to results that are limited to a specific set of keys- Parameters:
keys- a list of TEXT fields in the schemas- Returns:
- the query object itself
-
returnFields
Result's projection - the fields to return by the query- Parameters:
fields- a list of TEXT fields in the schemas- Returns:
- the query object itself
-
returnFields
Result's projection - the fields to return by the query- Parameters:
fields- a list of TEXT fields in the schemas- Returns:
- the query object itself
-
highlightFields
-
highlightFields
-
summarizeFields
-
summarizeFields
-
setSortBy
Set the query to be sorted by a Sortable field defined in the schema- Parameters:
field- the sorting field's nameascending- if set to true, the sorting order is ascending, else descending- Returns:
- the query object itself
-
addParam
Parameters can be referenced in the query string by a $ , followed by the parameter name, e.g., $user , and each such reference in the search query to a parameter name is substituted by the corresponding parameter value.- Parameters:
name-value- can be String, long or float- Returns:
- the query object itself
-
dialect
Set the dialect version to execute the query accordingly- Parameters:
dialect- integer- Returns:
- the query object itself
-
slop
Set the slop to execute the query accordingly- Parameters:
slop- integer- Returns:
- the query object itself
-
timeout
Set the timeout to execute the query accordingly- Parameters:
timeout- long- Returns:
- the query object itself
-
setInOrder
Set the query terms appear in the same order in the document as in the query, regardless of the offsets between them- Returns:
- the query object
-
setExpander
Set the query to use a custom query expander instead of the stemmer- Parameters:
field- the expander field's name- Returns:
- the query object itself
-