Invalid example in SpellChecker javadoc [LUCENE-7971]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
Hello, in Lucene javadoc for SpellChecker class there is an example of how to use it, however it's incorrect (wrong method signature).
File: lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java
It should be:
```java
SpellChecker spellchecker = new SpellChecker(spellIndexDirectory);
IndexWriterConfig config = new IndexWriterConfig();
spellchecker.indexDictionary(new LuceneDictionary(my_lucene_reader, a_field), config, true);
spellchecker.indexDictionary(new PlainTextDictionary(new File("myfile.txt")), config, true);
String[] suggestions = spellchecker.suggestSimilar("misspelt", 5);
```
Instead of:
```java
SpellChecker spellchecker = new SpellChecker(spellIndexDirectory);
spellchecker.indexDictionary(new LuceneDictionary(my_lucene_reader, a_field));
spellchecker.indexDictionary(new PlainTextDictionary(new File("myfile.txt")));
String[] suggestions = spellchecker.suggestSimilar("misspelt", 5);
```
I'm in the middle of sending pull request on Github. Just wanted to create JIRA ticket so I can reference it in my pull request.
---
Migrated from [LUCENE-7971](https://issues.apache.org/jira/browse/LUCENE-7971) by Bartosz Firyn (@sarxos)
Contributor guide
Research direction
Open lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java and find the javadoc usage example. Compare its indexDictionary calls with the signatures shown in the issue, then update the example so it matches the current API. Done means the javadoc presents the corrected calls and remains valid documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100