Skip to content

fix(search-pipeline): order the roots selectByClass pages through - #1076

Open
ddeboer wants to merge 1 commit into
mainfrom
fix/paginated-selector-order
Open

ddeboer wants to merge 1 commit into
mainfrom
fix/paginated-selector-order

Conversation

@ddeboer

@ddeboer ddeboer commented Nov 14, 2026

Copy link
Copy Markdown
Member

SparqlItemSelector pages with LIMIT/OFFSET, but SPARQL leaves solution order unspecified without ORDER BY. An endpoint that answers two pages in different orders can skip a root, and under a rebuild a skipped root counts as deleted. Nothing in the selector told a caller this, and selectByClass itself had no ORDER BY.

This PR takes option 1 from the issue:

  • selectByClass now ends in ORDER BY ?‹rootVariable›.
  • The JSDoc on ItemSelector, SparqlItemSelector and SparqlItemSelectorOptions.query says that a paginated query needs a total order over its projected variables. The same note is now in docs/reference/pipeline.md and docs/reference/search-pipeline.md.
  • The selector examples in the docs and the pipeline README now carry an ORDER BY, so copying one gives you a correct selector.

A new test checks that the selector keeps a query’s ORDER BY on every page, not just the first.

Your comment on the issue measured option 2 (inject an ORDER BY automatically) as free on a 17574-root class. I left it out of this PR; it can follow separately if you still want it.

Fixes #760

SPARQL leaves solution order unspecified without ORDER BY, so LIMIT/OFFSET pages
may skip or repeat a root between requests. selectByClass now ends in ORDER BY
?root, and ItemSelector and SparqlItemSelector document that a paginated query
needs a total order over its projected variables.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A paginated selector without ORDER BY can skip or repeat roots between pages

1 participant