Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

Redis FTAggregate with SORT BY doesnt work with Cursor

$
0
0

I am trying to process some data in batches using FTAggregate in Java. If I use sortBy I get results only on the ft.aggregate call and no results on subsequent cursor reads. My sort field is indexed as NUMERIC and SORTABLE. Am I doing something wrong or is it desired behaviour? Because I couldn't find any info on CURSOR and SORT BY interaction on Redis doc. Everything works fine if i remove the sortBy(). If I let only the sortBy() without limit() I get only 10 results and no subsequent ones because default limit for sort by is 10 if not specified otherwise. So my question is, can sortBy can work with CURSOR or should I use LIMIT with offset for paginating even if it would mean nuking the performance?

public void fetchData() {   var chuckSize = 1000;   var result = jedis.ftAggregate("myIndex", new AggregationBuilder("*")                     .loadAll()                     .sortBy("myField")                     .limit(chuckSize)                     .cursor(chuckSize, 1000));   var cursor = new AtomicLong(result.getCursorId());   while(true) {       try {         //process result         result = jedis.ftCursorRead("myIndex",cursor.get(), chunckSize);         cursor.set(result.getCursorId());       } catch(JedisDataException e) {         //data read end         break;       }}

Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>