apache / apache/lucene

Lazy initialize FixedBitSet in LRUQueryCache [LUCENE-10120]

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

Description

Basing on the implement of collecting docIds in DocsWithFieldSet, may be we could do similar way to cache docIdSet in **LRUQueryCache#cacheIntoBitSet(BulkScorer scorer, int maxDoc)** when docIdSet is density.

In this way , we do not always init a huge FixedBitSet which sometime is not necessary when maxDoc is large

![1.png](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-10120/1.png)

---
Migrated from [LUCENE-10120](https://issues.apache.org/jira/browse/LUCENE-10120) by Lu Xugang (@LuXugang), updated Mar 10 2022
Attachments: [1.png](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-10120/1.png), [LUCENE-10120.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-10120/LUCENE-10120.patch)
Pull requests: https://github.com/apache/lucene/pull/422, https://github.com/apache/lucene/pull/422, https://github.com/apache/lucene/pull/422, https://github.com/apache/lucene/pull/422, https://github.com/apache/lucene/pull/422, https://github.com/apache/lucene/pull/422, https://github.com/apache/lucene/pull/422

Contributor guide

Open the contributing guide

Research direction

Start with LRUQueryCache#cacheIntoBitSet(BulkScorer scorer, int maxDoc) and compare its doc ID collection with DocsWithFieldSet. Review the attached LUCENE-10120.patch and determine whether FixedBitSet can be allocated lazily for dense docId sets; done means avoiding unnecessary large allocation while preserving cache behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.