SearchResult's shows TotalResults 1000 but list size is 10.
public static List<Document> queryonId(UnifiedJedis client) {
Query q = new Query().addFilter(new Query.NumericFilter("id", 0, 10000)).setSortBy("id", true);
SearchResult result = client.ftSearch("student-index-test", q);
System.out.println("TotalResults :"+result.getTotalResults());
System.out.println("List size: "+result.getDocuments().size());
return result.getDocuments();
}
Output of above code
TotalResults :10000
List size: 10
Please let me know what is going wrong here.
ftSearch
method executes FT.SEARCH command. This command has an optional LIMIT
argument which controls the pagination in the search results. Description of this argument states:
LIMIT first num: Limit the results to the offset and number of results given. Note that the offset is zero-indexed. The default is 0 10, which returns 10 items starting from the first result.
As you are not putting your own paging value in the Query
object using the limit
method, you are getting the default number (10) of search results from the default position (0).