Hi,
I have an index and I’m using it from within a UDF. I’d like to allow the user to pass size/before/after parameters to the function and to use them inside when calling to the index.
Here’s what I tried, but it doesn’t work:
Query(
Lambda(
[
"paramA",
"paramB",
"size",
"cursorBefore",
"cursorAfter"
],
Let(
{
paging: If(
Not(IsNull(Var("cursorAfter"))),
{ size: Var("size"), after: Var("cursorAfter") },
If(
Not(IsNull(Var("cursorBefore"))),
{ size: Var("size"), before: Var("cursorBefore") },
{ size: Var("size") }
)
)
},
Map(
Paginate(
Match(Index("my_index"), [
Var("paramA"),
Var("paramB")
])
),
Var("paging") /*couldn't get anything here that works*/
),
Lambda(
["ref"],
Get(Var("ref"))
)
)
)
)
)
The above definition of paging
is very verbose and I got to it after a lot of trial and error that didn’t work. It seems that Paginate only accepts static paging definition.
Any idea?
Thanks!