apache / apache/lucene

BKDWriter refactor: Extract methods that serialise the tree into its own class [LUCENE-9284]

Open
#10,324 0 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Currently the class `BKDWriter` contains the logic to build the tree and serialise the tree. This makes the class difficult to understand and difficult to maintain. In this issue it is only proposed to move the methods the serialise the tree into the index to its own class called `BKDIndexWriter`. This class contains just two methods, one to write the leaf nodes and one to write the inner nodes.

 

While working on this, I wonder if the indexWriter should be an interface so we can get rid of `SimpleTextBKDWriter` and just use a different serialisation class for that case.  I left that for some further improvement.

---
Migrated from [LUCENE-9284](https://issues.apache.org/jira/browse/LUCENE-9284) by Ignacio Vera (@iverase)

Contributor guide

Open the contributing guide

Research direction

Start by reading BKDWriter to separate its tree-building logic from the methods that serialize the tree. Compare SimpleTextBKDWriter for the alternative serialization case. Done means the serialization methods are owned by a BKDIndexWriter class, while the interface question remains a possible follow-up.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.