apache / apache/lucene

BloomFilteringPostingsFormat should implement seekExact(TermState) to avoid to seek within matching segment/field multiple times [LUCENE-7770]

Open
#8,821 0 comments 0 reactions 0 assignees View on GitHub
affects-version:5.6 legacy-jira-priority:Minor module:core/codecs type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

BloomFilteringPostingsFormat$BloomFilteredFieldsProducer$BloomFilteredTermsEnum does not reuse the TermState from the initial lookup when a second seek is issued (usually when we have a match and we build the Scorer).

Default implementation of TermsEnum#seekExact(BytesRef term, TermState state) that is used by BF calls the regular seekExact method.

This means that the BloomFilteringPostingsFormat default implementation performs a second lookup for every segment/field that have a match for the term (mostly in the various Weight#scorer implementations).

I don't think it is a big issue as we mostly expect search terms to have a match in a limited number of segment/field. But for few queries it could become inefficient.

---
Migrated from [LUCENE-7770](https://issues.apache.org/jira/browse/LUCENE-7770) by Yannis Hector

Contributor guide

Open the contributing guide

Research direction

Start with BloomFilteringPostingsFormat$BloomFilteredFieldsProducer$BloomFilteredTermsEnum and inspect how TermsEnum#seekExact(BytesRef term, TermState state) is currently handled. Verify the initial lookup's TermState can be reused for the later seek, then confirm that matching segments and fields no longer perform a second lookup, including the scorer path described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.