Design: Are BlendedInfixSuggester's LINEAR_COEF and DEFAULT_NUM_FACTOR fields intended to be mutable?
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
(Found during reviewing code while porting to the [Lucene.NET](https://github.com/apache/lucenenet/) project.)
BlendedInfixSuggester has two static, mutable fields that seem like they might have been intended to be constants instead: [`LINEAR_COEF and DEFAULT_NUM_FACTOR`](https://github.com/apache/lucene/blob/dce24c8621748d51954c4845eab7626dae166db9/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java#L59-L64). We wanted to know whether it was intentional that these were mutable, or an oversight that should be corrected and both marked `final`.
`DEFAULT_NUM_FACTOR` does not seem to have much utility if it is modified, and could result in bugs if it is modified during execution. Perhaps there is good reasoning for modifying it, though, that could be documented on the field.
`LINEAR_COEF` seems like a possible use case for modifying it would be to change the algorithm's math, but if so it is unexpected then that it is protected instead of public.
Affects Lucene 4.7.0 through current (10.1.0).
Contributor guide
Research direction
Start with the referenced fields in lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java, then inspect their usages and related tests or conventions for configurable static fields. The work is done when the intended mutability is decided, the fields are changed or documented accordingly, and relevant tests cover the resulting 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