Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-20-2022 06:22 AM
I need to limit the search results returned by a full-text search based on an offset and limit. That means, the first query would return the first 10 results (offset=0, limit=10) and a second query would return the next 10 results (offset=10, limit=10).
My current query uses apoc.agg.slice() to slice the result set accordingly:
CALL db.index.fulltext.queryNodes($index, $searchQuery) YIELD node, score
WITH apoc.agg.slice({node: node, score: score}, $offset, $limit) as records
RETURN collect({node: node, score: score}) as records
However, I was checking the Java implementation for db.index.fulltext.queryNodes() and noticed that there is a third parameter options which allows skip and limit:
CALL db.index.fulltext.queryNodes($index,$searchQuery,{skip: 0, limit: 10})
This parameter seems to not be officially documented on the full-text search manual.
Therefore, my two questions are:
Solved! Go to Solution.
12-20-2022 07:33 AM - edited 12-20-2022 07:34 AM
Hi @chrszrkl
Good catch. We will get this updated in the docs. This should be more performant than the apoc option, as it can push the filtering into Lucene.
edit: it's here: https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_index_fulltext_q...
J
12-20-2022 07:33 AM - edited 12-20-2022 07:34 AM
Hi @chrszrkl
Good catch. We will get this updated in the docs. This should be more performant than the apoc option, as it can push the filtering into Lucene.
edit: it's here: https://neo4j.com/docs/operations-manual/current/reference/procedures/#procedure_db_index_fulltext_q...
J
12-20-2022 11:36 PM
Great, that makes the pagination for search results a little easier!
All the sessions of the conference are now available online