Pagination in LLIST


#1

There’s find_first and find_last to get the first and last N elements of an ordered list. Why not a range equivalent to get the start to start+ count elements? I understand there’s the range function, but this isn’t quite the effect I require.


#2

Zhongcai_Ng

There is find_from function as well. You can use it to pick count number of elements from certain key. So pagination would look like

find_first(10)

find_from(K10, 10)

find_from(K20, 20)

Where K10 is last key found in find_first.

HTH

– R


#3

Hi Raj,

Thanks for the information! I am having issues finding the function find_from. Can you assist?

I reference you the lua script at Github. https://github.com/aerospike/aerospike-lua-core/blob/master/src/ldt/lib_llist.lua#L63-L88

This is what I did…

local llist= require("ldt/lib_llist");

Then at end of function I tried to return the LLIST

return llist.find_from(rec, "abc", "bravo", 2, nil, nil, nil)

My error message is

Error100, attempt to call field ‘find_from’ (a nil value)

Besides, find_from requires it in Key. Is it possible to build one to take in the index position?


#4

Still not pushed into open source.

find_from requires it in Key. Is it possible to build one to take in the index position?

No it is not from offset

Are you building from source ???

following works fine on 3.5.15

aql> execute llist.add('lbin', 10) on test where PK=1
+-----+
| add |
+-----+
| 0   |
+-----+

1 row in set (0.000 secs)

aql> execute llist.add('lbin', 11) on test where PK=1
+-----+
| add |
+-----+
| 0   |
+-----+
1 row in set (0.001 secs)

aql> execute llist.add('lbin', 12) on test where PK=1
+-----+
| add |
+-----+
| 0   |
+-----+
1 row in set (0.000 secs)

aql> execute llist.find('lbin', 12) on test where PK=1
+------+
| find | 
+------+
| [12] |
+------+
1 row in set (0.000 secs)

aql> execute llist.find_from('lbin', 11, 1) on test where PK=1 
+-----------+
| find_from | 
+-----------+
| [11]      |
+-----------+
1 row in set (0.000 secs)

aql> execute llist.find_from('lbin', 11, 2) on test where PK=1
+-----------+
| find_from | 
+-----------+
| [11, 12]  |
+-----------+
1 row in set (0.000 secs)

HTH

– R


#5

@Zhongcai_Ng,

Thank you for posting about LDTs in our forum. Please see the LDT Feature Guide for current LDT recommendations and best practices.


#6

@Zhongcai_Ng,

Effective immediately, we will no longer actively support the LDT feature and will eventually remove the API. The exact deprecation and removal timeline will depend on customer and community requirements. Instead of LDTs, we advise that you use our newer List and SortedMap APIs, which are now available in all Aerospike-supported clients at the General Availability level. Read our blog post for details.