Package org.redisson
Class RedissonSearch
java.lang.Object
org.redisson.RedissonSearch
- All Implemented Interfaces:
RSearch
,RSearchAsync
- Author:
- Nikita Koksharov
-
Constructor Summary
ConstructorDescriptionRedissonSearch
(Codec codec, CommandAsyncExecutor commandExecutor) RedissonSearch
(CommandAsyncExecutor commandExecutor) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds alias to defined index nameaddAliasAsync
(String alias, String indexName) Adds alias to defined index namelong
Adds defined terms to the dictionaryaddDictAsync
(String dictionary, String... terms) Adds defined terms to the dictionaryaggregate
(String indexName, String query, AggregationOptions options) Executes aggregation over defined index using defined query.aggregateAsync
(String indexName, String query, AggregationOptions options) Executes aggregation over defined index using defined query.void
alter
(String indexName, boolean skipInitialScan, FieldIndex... fields) Adds a new attribute to the indexalterAsync
(String indexName, boolean skipInitialScan, FieldIndex... fields) Adds a new attribute to the indexvoid
createIndex
(String indexName, IndexOptions options, FieldIndex... fields) Creates an index.createIndexAsync
(String indexName, IndexOptions options, FieldIndex... fields) Creates an index.void
Deletes index aliasdelAliasAsync
(String alias) Deletes index aliasvoid
Deletes cursor by index name and iddelCursorAsync
(String indexName, long cursorId) Deletes cursor by index name and idlong
Deletes defined terms from the dictionarydelDictAsync
(String dictionary, String... terms) Deletes defined terms from the dictionaryvoid
Deletes index by namevoid
dropIndexAndDocuments
(String indexName) Deletes index by name and associated documents.dropIndexAndDocumentsAsync
(String indexName) Deletes index by name and associated documentsdropIndexAsync
(String indexName) Deletes index by name and associated documents.Returns terms stored in the dictionarydumpDictAsync
(String dictionary) Returns terms stored in the dictionarydumpSynonyms
(String indexName) Returns synonyms mapped by word by defined index namedumpSynonymsAsync
(String indexName) Returns synonyms mapped by word by defined index nameReturns configuration map by defined parameter namegetConfigAsync
(String parameter) Returns configuration map by defined parameter nameReturns list of all created indexesReturns list of all created indexesReturns index info by nameReturns index info by namereadCursor
(String indexName, long cursorId) Returns next results by index name and cursor idreadCursor
(String indexName, long cursorId, int count) Returns next results by index name, cursor id and results sizereadCursorAsync
(String indexName, long cursorId) Returns next results by index name and cursor idreadCursorAsync
(String indexName, long cursorId, int count) Returns next results by index name, cursor id and results sizesearch
(String indexName, String query, QueryOptions options) Executes search over defined index using defined query.searchAsync
(String indexName, String query, QueryOptions options) Executes search over defined index using defined query.void
Sets configuration value by the parameter namesetConfigAsync
(String parameter, String value) Sets configuration value by the parameter namespellcheck
(String indexName, String query, SpellcheckOptions options) Executes spell checking by defined index name and query.spellcheckAsync
(String indexName, String query, SpellcheckOptions options) Executes spell checking by defined index name and query.void
updateAlias
(String alias, String indexName) Adds alias to defined index name.updateAliasAsync
(String alias, String indexName) Adds alias to defined index name.void
updateSynonyms
(String indexName, String synonymGroupId, String... terms) Updates synonymsupdateSynonymsAsync
(String indexName, String synonymGroupId, String... terms) Updates synonyms
-
Constructor Details
-
RedissonSearch
-
RedissonSearch
-
-
Method Details
-
createIndex
Description copied from interface:RSearch
Creates an index.Code example:
search.create("idx", IndexOptions.defaults() .on(IndexType.HASH) .prefix(Arrays.asList("doc:")), FieldIndex.text("t1"), FieldIndex.tag("t2").withSuffixTrie());
- Specified by:
createIndex
in interfaceRSearch
- Parameters:
indexName
- index nameoptions
- index optionsfields
- fields
-
createIndexAsync
Description copied from interface:RSearchAsync
Creates an index.Code example:
search.create("idx", IndexOptions.defaults() .on(IndexType.HASH) .prefix(Arrays.asList("doc:")), FieldIndex.text("t1"), FieldIndex.tag("t2").withSuffixTrie());
- Specified by:
createIndexAsync
in interfaceRSearchAsync
- Parameters:
indexName
- index nameoptions
- index optionsfields
- fields
-
search
Description copied from interface:RSearch
Executes search over defined index using defined query.Code example:
SearchResult r = s.search("idx", "*", QueryOptions.defaults() .returnAttributes(new ReturnAttribute("t1"), new ReturnAttribute("t2")));
-
searchAsync
Description copied from interface:RSearchAsync
Executes search over defined index using defined query.Code example:
SearchResult r = s.search("idx", "*", QueryOptions.defaults() .returnAttributes(new ReturnAttribute("t1"), new ReturnAttribute("t2")));
- Specified by:
searchAsync
in interfaceRSearchAsync
- Parameters:
indexName
- index namequery
- query valueoptions
- query options- Returns:
- search result
-
aggregate
Description copied from interface:RSearch
Executes aggregation over defined index using defined query.Code example:
AggregationResult r = s.aggregate("idx", "*", AggregationOptions.defaults() .load("t1", "t2"));
-
aggregateAsync
public RFuture<AggregationResult> aggregateAsync(String indexName, String query, AggregationOptions options) Description copied from interface:RSearchAsync
Executes aggregation over defined index using defined query.Code example:
AggregationResult r = s.aggregate("idx", "*", AggregationOptions.defaults() .load("t1", "t2"));
- Specified by:
aggregateAsync
in interfaceRSearchAsync
- Parameters:
indexName
- index namequery
- query valueoptions
- aggregation options- Returns:
- aggregation result
-
addAlias
Description copied from interface:RSearch
Adds alias to defined index name -
addAliasAsync
Description copied from interface:RSearchAsync
Adds alias to defined index name- Specified by:
addAliasAsync
in interfaceRSearchAsync
- Parameters:
alias
- alias valueindexName
- index name
-
delAlias
Description copied from interface:RSearch
Deletes index alias -
delAliasAsync
Description copied from interface:RSearchAsync
Deletes index alias- Specified by:
delAliasAsync
in interfaceRSearchAsync
- Parameters:
alias
- alias value
-
updateAlias
Description copied from interface:RSearch
Adds alias to defined index name. Re-assigns the alias if it was used before with a different index.- Specified by:
updateAlias
in interfaceRSearch
- Parameters:
alias
- alias valueindexName
- index name
-
updateAliasAsync
Description copied from interface:RSearchAsync
Adds alias to defined index name. Re-assigns the alias if it was used before with a different index.- Specified by:
updateAliasAsync
in interfaceRSearchAsync
- Parameters:
alias
- alias valueindexName
- index name
-
alter
Description copied from interface:RSearch
Adds a new attribute to the index -
alterAsync
Description copied from interface:RSearchAsync
Adds a new attribute to the index- Specified by:
alterAsync
in interfaceRSearchAsync
- Parameters:
indexName
- index nameskipInitialScan
- doesn't scan the index iftrue
fields
- field indexes
-
getConfig
Description copied from interface:RSearch
Returns configuration map by defined parameter name -
getConfigAsync
Description copied from interface:RSearchAsync
Returns configuration map by defined parameter name- Specified by:
getConfigAsync
in interfaceRSearchAsync
- Parameters:
parameter
- parameter name- Returns:
- configuration map
-
setConfig
Description copied from interface:RSearch
Sets configuration value by the parameter name -
setConfigAsync
Description copied from interface:RSearchAsync
Sets configuration value by the parameter name- Specified by:
setConfigAsync
in interfaceRSearchAsync
- Parameters:
parameter
- parameter namevalue
- parameter value
-
delCursor
Description copied from interface:RSearch
Deletes cursor by index name and id -
delCursorAsync
Description copied from interface:RSearchAsync
Deletes cursor by index name and id- Specified by:
delCursorAsync
in interfaceRSearchAsync
- Parameters:
indexName
- index namecursorId
- cursor id
-
readCursor
Description copied from interface:RSearch
Returns next results by index name and cursor id- Specified by:
readCursor
in interfaceRSearch
- Parameters:
indexName
- index namecursorId
- cursor id- Returns:
- aggregation result
-
readCursorAsync
Description copied from interface:RSearchAsync
Returns next results by index name and cursor id- Specified by:
readCursorAsync
in interfaceRSearchAsync
- Parameters:
indexName
- index namecursorId
- cursor id- Returns:
- aggregation result
-
readCursor
Description copied from interface:RSearch
Returns next results by index name, cursor id and results size- Specified by:
readCursor
in interfaceRSearch
- Parameters:
indexName
- index namecursorId
- cursor idcount
- results size- Returns:
- aggregation result
-
readCursorAsync
Description copied from interface:RSearchAsync
Returns next results by index name, cursor id and results size- Specified by:
readCursorAsync
in interfaceRSearchAsync
- Parameters:
indexName
- index namecursorId
- cursor idcount
- results size- Returns:
- aggregation result
-
addDict
Description copied from interface:RSearch
Adds defined terms to the dictionary -
addDictAsync
Description copied from interface:RSearchAsync
Adds defined terms to the dictionary- Specified by:
addDictAsync
in interfaceRSearchAsync
- Parameters:
dictionary
- dictionary nameterms
- terms- Returns:
- number of new terms
-
delDict
Description copied from interface:RSearch
Deletes defined terms from the dictionary -
delDictAsync
Description copied from interface:RSearchAsync
Deletes defined terms from the dictionary- Specified by:
delDictAsync
in interfaceRSearchAsync
- Parameters:
dictionary
- dictionary nameterms
- terms- Returns:
- number of deleted terms
-
dumpDict
Description copied from interface:RSearch
Returns terms stored in the dictionary -
dumpDictAsync
Description copied from interface:RSearchAsync
Returns terms stored in the dictionary- Specified by:
dumpDictAsync
in interfaceRSearchAsync
- Parameters:
dictionary
- dictionary name- Returns:
- terms
-
dropIndex
Description copied from interface:RSearch
Deletes index by name -
dropIndexAsync
Description copied from interface:RSearchAsync
Deletes index by name and associated documents. Associated documents are deleted asynchronously. MethodRSearchAsync.infoAsync(String)
can be used to check for process completion.- Specified by:
dropIndexAsync
in interfaceRSearchAsync
- Parameters:
indexName
- index name
-
dropIndexAndDocuments
Description copied from interface:RSearch
Deletes index by name and associated documents. Associated documents are deleted asynchronously. MethodRSearch.info(String)
can be used to check for process completion.- Specified by:
dropIndexAndDocuments
in interfaceRSearch
- Parameters:
indexName
- index name
-
dropIndexAndDocumentsAsync
Description copied from interface:RSearchAsync
Deletes index by name and associated documents- Specified by:
dropIndexAndDocumentsAsync
in interfaceRSearchAsync
- Parameters:
indexName
- index name
-
info
Description copied from interface:RSearch
Returns index info by name -
infoAsync
Description copied from interface:RSearchAsync
Returns index info by name- Specified by:
infoAsync
in interfaceRSearchAsync
- Parameters:
indexName
- index name- Returns:
- index info
-
spellcheck
public Map<String,Map<String, spellcheckDouble>> (String indexName, String query, SpellcheckOptions options) Description copied from interface:RSearch
Executes spell checking by defined index name and query. Returns a map of misspelled terms and their score.Mapinvalid input: '<'String, Mapinvalid input: '<'String, Double>> res = s.spellcheck("idx", "Hocke sti", SpellcheckOptions.defaults() .includedTerms("name"));
- Specified by:
spellcheck
in interfaceRSearch
- Parameters:
indexName
- index namequery
- queryoptions
- spell checking options- Returns:
- map of misspelled terms and their score
-
spellcheckAsync
public RFuture<Map<String,Map<String, spellcheckAsyncDouble>>> (String indexName, String query, SpellcheckOptions options) Description copied from interface:RSearchAsync
Executes spell checking by defined index name and query. Returns a map of misspelled terms and their score.Mapinvalid input: '<'String, Mapinvalid input: '<'String, Double>> res = s.spellcheck("idx", "Hocke sti", SpellcheckOptions.defaults() .includedTerms("name"));
- Specified by:
spellcheckAsync
in interfaceRSearchAsync
- Parameters:
indexName
- index namequery
- queryoptions
- spell checking options- Returns:
- map of misspelled terms and their score
-
dumpSynonyms
Description copied from interface:RSearch
Returns synonyms mapped by word by defined index name- Specified by:
dumpSynonyms
in interfaceRSearch
- Parameters:
indexName
- index name- Returns:
- synonyms map
-
dumpSynonymsAsync
Description copied from interface:RSearchAsync
Returns synonyms mapped by word by defined index name- Specified by:
dumpSynonymsAsync
in interfaceRSearchAsync
- Parameters:
indexName
- index name- Returns:
- synonyms map
-
updateSynonyms
Description copied from interface:RSearch
Updates synonyms- Specified by:
updateSynonyms
in interfaceRSearch
- Parameters:
indexName
- index namesynonymGroupId
- synonym group idterms
- terms
-
updateSynonymsAsync
Description copied from interface:RSearchAsync
Updates synonyms- Specified by:
updateSynonymsAsync
in interfaceRSearchAsync
- Parameters:
indexName
- index namesynonymGroupId
- synonym group idterms
- terms
-
getIndexes
Description copied from interface:RSearch
Returns list of all created indexes- Specified by:
getIndexes
in interfaceRSearch
- Returns:
- list of indexes
-
getIndexesAsync
Description copied from interface:RSearchAsync
Returns list of all created indexes- Specified by:
getIndexesAsync
in interfaceRSearchAsync
- Returns:
- list of indexes
-