SpellChecker : SpellChecker.indexDictionary : Javadoc incorrect [LUCENE-4487]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
example code in javadoc seems to be incorrect
code changes from #4631
means the javadoc
```Java
SpellChecker spellchecker = new SpellChecker(spellIndexDirectory);
// To index a field of a user index:
spellchecker.indexDictionary(new LuceneDictionary(my_lucene_reader, a_field));
// To index a file containing words:
spellchecker.indexDictionary(new PlainTextDictionary(new File("myfile.txt")));
String[] suggestions = spellchecker.suggestSimilar("misspelt", 5);
```
is incorrect i think something like this is better maybe
```Java
SpellChecker spellchecker = new SpellChecker(spellIndexDirectory);
// To index a field of a user index:
spellchecker.indexDictionary(new LuceneDictionary(my_lucene_reader, a_field), new IndexWriterConfig(Version.LUCENE_CURRENT, null), false);
// To index a file containing words:
spellchecker.indexDictionary(new PlainTextDictionary(new File("myfile.txt")), new IndexWriterConfig(Version.LUCENE_CURRENT, null), false);
String[] suggestions = spellchecker.suggestSimilar("misspelt", 5);
```
I'd possibly add something about creating a spellIndexDirectory too, not clear
```Java
Directory spellIndexDirectory = FSDirectory.open("/dev/tmp/SOME_WORKING_DIR");
SpellChecker spellchecker = new SpellChecker(spellIndexDirectory);
// To index a field of a user index:
spellchecker.indexDictionary(new LuceneDictionary(my_lucene_reader, a_field), new IndexWriterConfig(Version.LUCENE_CURRENT, null), false);
// To index a file containing words:
spellchecker.indexDictionary(new PlainTextDictionary(new File("myfile.txt")), new IndexWriterConfig(Version.LUCENE_CURRENT, null), false);
String[] suggestions = spellchecker.suggestSimilar("misspelt", 5);
```
would of sent a patch but not familiar with how to get access to the apache git repo todo a pull/push
cheers
Ant
---
Migrated from [LUCENE-4487](https://issues.apache.org/jira/browse/LUCENE-4487) by Anthony Mckale
Linked issues:
- #4631
Contributor guide
Research direction
Start with the SpellChecker.indexDictionary Javadoc and its current method signature, then compare the example with the API change from #4631. Update the example so its calls and setup match the available API, and verify that the generated Javadoc example is accurate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100