apache / apache/lucene

On many analyzers, the getDefaultStopSet() method returns a modifiable set, contrary to the docs

Open
#11,866 2 comments 0 reactions 0 assignees View on GitHub
type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

Several of the analyzers state that they are supposed to return an unmodifiable `CharArraySet`, but the set that is returned is writable, as you can see in the source.

https://github.com/apache/lucene/blob/cc342ea7407c729a743123d8f7957aff6c6f9792/lucene/analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchAnalyzer.java#L67-L92

Note that the `Wordlistloader.getWordSet()` method also returns a writable `CharArraySet` and it is stored in static fields in several analyzers.

### Version and environment details

All versions, all environments

Contributor guide

Open the contributing guide

Research direction

Start with the referenced FrenchAnalyzer.java implementation and inspect Wordlistloader.getWordSet(), then trace the other analyzers that store or return these sets. Confirm the documented behavior for getDefaultStopSet() and identify the affected analyzer implementations. Done means the returned CharArraySet instances are unmodifiable as documented across the affected analyzers.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.