K - the type of keys used in the search resultsV - the type of values used in the search resultspublic class SearchReplyParser<K,V> extends Object implements ComplexDataParser<SearchReply<K,V>>
SearchReply
objects. This parser handles both RESP2 and RESP3 protocol responses and supports various search result formats including
results with scores, content, IDs, and cursor-based pagination.
The parser automatically detects the Redis protocol version and switches between RESP2 and RESP3 parsing strategies. It supports the following search result features:
| Constructor and Description |
|---|
SearchReplyParser(RedisCodec<K,V> codec)
Creates a new SearchReplyParser with default parsing configuration.
|
SearchReplyParser(RedisCodec<K,V> codec,
SearchArgs<K,V> args)
Creates a new SearchReplyParser configured based on the provided search arguments.
|
| Modifier and Type | Method and Description |
|---|---|
SearchReply<K,V> |
parse(ComplexData data)
Parses Redis Search command response data into a structured
SearchReply object. |
public SearchReplyParser(RedisCodec<K,V> codec, SearchArgs<K,V> args)
SearchReply.codec - the Redis codec used for encoding/decoding keys and values. Must not be null.args - the search arguments that determine parsing behavior. If null, default parsing behavior is used (with
content, without scores, with IDs).
args.isWithScores() is true, search scores will be parsed and includedargs.isNoContent() is true, document content will be excluded from parsingpublic SearchReplyParser(RedisCodec<K,V> codec)
Default configuration:
withScores = false)withContent = true)withIds = false)codec - the Redis codec used for encoding/decoding keys and values. Must not be null.public SearchReply<K,V> parse(ComplexData data)
SearchReply object. This method automatically detects
the Redis protocol version (RESP2 or RESP3) and uses the appropriate parsing strategy.parse in interface ComplexDataParser<SearchReply<K,V>>data - the complex data structure returned by Redis containing the search results. Must not be null.SearchReply containing the parsed search results. Never null. Returns an empty
SearchReply if parsing fails.Copyright © 2025 lettuce.io. All rights reserved.