returns list with 10 elements

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.

Unless defined otherwise the default LIMIT is 10.

You can easily set the limit this way,

new Query.NumericFilter("id", 0, 10000).limit(0, 1000)

@gkorland You are right, It is working Thanks for the reply.

1 Like