Refactoring of SegmentInfos [LUCENE-7904]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
Hello everyone.
I was analyzing the modularization of some classes, and I identified that the class SegmentInfos has an opportunity for cohesion improvement.
The class IndexWriter was in the same situation and the problem was solved as follows: The IndexWriterConfig class was created, and several get() and set() methods that were used only to configure the class parameters were moved from IndexWriter to IndexWriterConfig.
The new class was then accessed through an instance variable in IndexWriter. This strategy has cleaned and improved IndexWriter cohesion.
With this in mind, I would recommend creating a new class: SegmentInfosConfig , and moving the following methods:
getLastCommitGeneration
getLastCommitSegmentsFileName
getSegmentsFileName
getNextPendingGeneration
getId
getVersion
getGeneration
getLastGeneration
setInfoStream
getInfoStream
setNextWriteGeneration
setUserData
setVersion
getCommitLuceneVersion
getMinSegmentLuceneVersion
from the SegmentInfos.
Those parameters accessed by an instance variable in the SegmentInfos.
Moreover, the orthogonality is the design would be enhanced.
What do you think about that?
---
Migrated from [LUCENE-7904](https://issues.apache.org/jira/browse/LUCENE-7904) by João Paulo Lemes Machado, updated Jul 17 2017
Contributor guide
Research direction
Start by reading SegmentInfos and the analogous IndexWriter and IndexWriterConfig design described in the issue. Confirm whether the proposed SegmentInfosConfig extraction is still wanted, then identify the affected tests and define completion around moving the listed configuration methods without changing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100