tantivy icon indicating copy to clipboard operation
tantivy copied to clipboard

Is it possible to pass in a bitset of document ids to be considered in pruning for TermQuery (and BooleanQuery).

Open ivankelly opened this issue 1 month ago • 0 comments

Specifically, I have a segment, and a mapping of doc ids to our internal IDs. We produce filters which we want to use to search a subset of documents, and from these we can produce a bitmap of docids.

My question is whether it is possible, given the current mechanisms exposed, to use this bitmap to skip blocks while traversing postings for a TermQuery (or BooleanQuery with many term sub queries).

For example, how I imagine this would work is that TermQuery::block_max_score would return a zero score for a block if there are no docids in the block that conform to the bitset.

From my current understanding of the code this isn't currently possible, but I wanted to confirm with folks with a better understanding before hacking at it. I can see how we can do postfiltering, but I want to avoid the I/O on the blocks if possible.

ivankelly avatar Nov 14 '25 10:11 ivankelly