Modifier and Type | Class and Description |
---|---|
static class |
Query.Filter
Filter represents a filtering rules in a query
|
static class |
Query.GeoFilter
GeoFilter encapsulates a radius filter on a geographical indexed fields
|
static class |
Query.HighlightTags |
static class |
Query.NumericFilter
NumericFilter wraps a range filter on a numeric field.
|
static class |
Query.Paging |
Constructor and Description |
---|
Query() |
Query(String queryString)
Create a new index
|
Modifier and Type | Method and Description |
---|---|
Query |
addFilter(Query.Filter f)
Add a filter to the query's filter list
|
Query |
addParam(String name,
Object value)
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.
|
void |
addParams(CommandArguments args) |
Query |
dialect(int dialect)
Set the dialect version to execute the query accordingly
|
boolean |
getNoContent() |
boolean |
getWithPayloads() |
boolean |
getWithScores() |
Query |
highlightFields(Query.HighlightTags tags,
String... fields) |
Query |
highlightFields(String... fields) |
Query |
limit(Integer offset,
Integer limit)
Limit the results to a certain offset and limit
|
Query |
limitFields(String... fields)
Limit the query to results that are limited to a specific set of fields
|
Query |
limitKeys(String... keys)
Limit the query to results that are limited to a specific set of keys
|
Query |
returnFields(FieldName... fields)
Result's projection - the fields to return by the query
|
Query |
returnFields(String... fields)
Result's projection - the fields to return by the query
|
Query |
setLanguage(String language)
Set the query language, for stemming purposes
|
Query |
setNoContent()
Set the query not to return the contents of documents, and rather just return the ids
|
Query |
setNoStopwords()
Set the query not to filter for stopwords.
|
Query |
setPayload(byte[] payload) |
Query |
setScorer(String scorer)
Set the query custom scorer
|
Query |
setSortBy(String field,
boolean ascending)
Set the query to be sorted by a Sortable field defined in the schema
|
Query |
setVerbatim()
Set the query to verbatim mode, disabling stemming and query expansion
|
Query |
setWithPayload()
Set the query to return object payloads, if any were given
|
Query |
setWithScores()
Set the query to return a factored score for each results.
|
Query |
summarizeFields(int contextLen,
int fragmentCount,
String separator,
String... fields) |
Query |
summarizeFields(String... fields) |
public Query()
public Query(String queryString)
queryString
- the textual part of the querypublic void addParams(CommandArguments args)
public Query limit(Integer offset, Integer limit)
offset
- the first result to show, zero based indexinglimit
- how many results we want to showpublic Query addFilter(Query.Filter f)
f
- either a numeric or geo filter objectpublic Query setPayload(byte[] payload)
public Query setVerbatim()
public boolean getNoContent()
public Query setNoContent()
public Query setNoStopwords()
public boolean getWithScores()
public Query setWithScores()
public boolean getWithPayloads()
public Query setWithPayload()
public Query setLanguage(String language)
See http://redisearch.io for documentation on languages and stemming
language
- a language.public Query setScorer(String scorer)
See http://redisearch.io for documentation on extending RediSearch
scorer
- a custom scorer.public Query limitFields(String... fields)
fields
- a list of TEXT fields in the schemaspublic Query limitKeys(String... keys)
keys
- a list of TEXT fields in the schemaspublic Query returnFields(String... fields)
fields
- a list of TEXT fields in the schemaspublic Query returnFields(FieldName... fields)
fields
- a list of TEXT fields in the schemaspublic Query highlightFields(Query.HighlightTags tags, String... fields)
public Query summarizeFields(int contextLen, int fragmentCount, String separator, String... fields)
public Query setSortBy(String field, boolean ascending)
field
- the sorting field's nameascending
- if set to true, the sorting order is ascending, else descendingpublic Query addParam(String name, Object value)
name
- value
- can be String, long or floatpublic Query dialect(int dialect)
dialect
- integerCopyright © 2022. All rights reserved.