The GitHub Actions job "Build" on jackrabbit-oak.git/oak-search-mongot has 
failed.
Run started by GitHub user DominikSuess (triggered by DominikSuess).

Head commit for run:
5410acd11aab4c59a6aa101c12984138103b298f / Dominik Suess <[email protected]>
OAK: use a query-specific $count estimator instead of draining the cursor for 
Cursor.getSize()

streamingCursor() wired rows::getSize (MongotResultIterator.getSize()) as the
Cursor's SizeEstimator, which fully drains the entire result cursor - in the
same batched round trips fixed in the previous commit - the moment anything
calls Cursor.getSize()/JCR's RowIterator.getSize() (a common "N results
found" UI pattern), even if the caller never intends to iterate all rows.

Meanwhile MongotIndex.getSizeEstimator(IndexPlan) was already implemented
(cheap, index-level numDocs()) but never actually invoked anywhere in this
class - dead code - unlike ElasticIndex, which wires its equivalent,
query-filtered getDocCountFor() into its own non-facet query path.

numDocs() itself isn't a like-for-like replacement here: it's a whole-index
count, not filtered by this query's predicate, so reusing it as-is would
silently return the wrong (larger) count. Instead, add a query-specific
countMatches() helper that appends $count to the already-built pipeline -
a cheap server-side count with no document bodies returned - and wire that
into streamingCursor() in place of the drain-based estimator. Documented
that the existing getSizeEstimator(IndexPlan) override is now intentionally
unused (kept only to satisfy the FulltextIndex SPI contract).

Co-authored-by: Copilot <[email protected]>

Report URL: https://github.com/apache/jackrabbit-oak/actions/runs/35973384209

With regards,
GitHub Actions via GitBox

Reply via email to