K - Key type.V - Value type.public class SearchReply<K,V> extends Object
This class encapsulates the search results including the total count of matching documents and a list of individual search result documents. Each document contains the document ID and optionally the document fields, score, payload, and sort keys depending on the search arguments used.
| Modifier and Type | Class and Description |
|---|---|
static class |
SearchReply.SearchResult<K,V>
Represents a single search result document.
|
| Constructor and Description |
|---|
SearchReply()
Creates a new empty SearchReply instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addResult(SearchReply.SearchResult<K,V> result)
Adds a search result document to the results list.
|
long |
getCount()
Gets the total number of matching documents.
|
Long |
getCursorId()
Gets the cursor ID for paginated results.
|
List<SearchReply.SearchResult<K,V>> |
getResults()
Gets the list of search result documents.
|
List<V> |
getWarnings() |
boolean |
isEmpty()
Checks if the search results are empty.
|
int |
size()
Gets the number of search result documents returned.
|
public long getCount()
This represents the total count of documents that match the search query, which may be larger than the number of results returned if LIMIT was used.
public List<SearchReply.SearchResult<K,V>> getResults()
Each result contains the document ID and optionally the document fields, score, payload, and sort keys depending on the search arguments used.
public void addResult(SearchReply.SearchResult<K,V> result)
result - the search result document to addpublic int size()
This may be different from getCount() if LIMIT was used in the search.
public boolean isEmpty()
public Long getCursorId()
This is only available when using cursor-based pagination with FT.AGGREGATE WITHCURSOR. A cursor ID of 0 indicates that there are no more results to fetch.
Copyright © 2025 lettuce.io. All rights reserved.