Reuse TermsEnum in BlockTreeTermsReader [LUCENE-4688]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
Opening a TermsEnum comes with a significant cost at this point if done frequently like primary key lookups or if many segments are present. Currently we don't reuse it at all and create a lot of objects even if the enum is just used for a single seekExact (ie. TermQuery). Stressing the Terms#iterator(reuse) call shows significant gains with reuse...
---
Migrated from [LUCENE-4688](https://issues.apache.org/jira/browse/LUCENE-4688) by Simon Willnauer (@s1monw), updated May 09 2016
Attachments: [LUCENE-4688.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-4688/LUCENE-4688.patch)
Contributor guide
Research direction
Start by locating BlockTreeTermsReader and tracing how Terms#iterator(reuse) is currently called when a TermsEnum is opened. Reproduce the reported stress case involving frequent seekExact calls or many segments, then verify that TermsEnum instances are reused without changing lookup behavior or search results.
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
- 35/100