How to use index.queryLuaObjects()?

I try to figure out how to use index.queryLuaObjects() but I hit a brick wall:

It works fine with the given example local tasks = index.queryLuaObjects("mytask", {limit=3}) , but I can’t get it to do much more.

Especially select and where would be interesting. I found promising hints in the source, but I can’t put the pieces together. :confused:

How can I write a lua live query like below with queryLuaObjects()? How to use _ in the query argument of the function?

query[[from index.tag "task" 
 where _.deadline and _.deadline > "2025-01-01" 
 order by deadline 
 limit 10 
 select {deadline=_.deadline, ref="[[".._.ref.."]]", task=name}
]]
1 Like

I’d consider this an internal API, I should probably mark it this way. The preferred path is to just use the integrated query language. What are trying to achieve? I’d hope there are better ways.

1 Like

Ah, good to know. I am experimenting with something like a django queryset. But I think I can do what I need with the integrated queries by calling functions in the where and select clauses.

1 Like