Skip to content

Add DocIdSet cache to speed up multiretriever aggregation#1005

Open
waziqi89 wants to merge 1 commit into
mainfrom
devel
Open

Add DocIdSet cache to speed up multiretriever aggregation#1005
waziqi89 wants to merge 1 commit into
mainfrom
devel

Conversation

@waziqi89

Copy link
Copy Markdown
Contributor

https://jira.yelpcorp.com/browse/RP-16311
https://docs.google.com/document/d/1lvGjNSzzYJ8CHHXb8qxS3yMx-iLQW_qRZK7Z-WHBt-0/edit?tab=t.5443g0bbb9aw#heading=h.u9nrgnw9ioas
Add a new internal MultiRetrieverAggregationQuery backed by a docId cache to record hit docId without scores. Use this query to avoid second-pass for union query during the aggregation.

Under either condition, the query will fallback to the union query during the rewrite:

  • Early exit (stop caching) when any leaf hit > 7k ()
  • The aggregation collector need score

…er aggregation pass

During multi-retriever search, the aggregation pass (collectors/facets) previously
re-executed the full union query from scratch. This change captures doc IDs into
per-retriever SparseFixedBitSets during the retriever recall phase and replays them
for aggregation via a lightweight cached query — avoiding the expensive re-execution.

Protection: each retriever short-circuits at 7k docs (plain int counter, no atomics).
If any retriever exceeds the threshold, the cache is invalidated and the aggregation
transparently falls back to the union query via MultiRetrieverAggregationQuery.rewrite().

Co-Authored-By: Claude <noreply@anthropic.com>
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.

1 participant