Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
3.6.1
-
None
-
None
-
New
Description
example code in javadoc seems to be incorrect
code changes from LUCENE-3557
means the javadoc
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
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
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
Attachments
Issue Links
- is related to
-
LUCENE-3557 Spellchecker should take IndexWriterConfig... deprecate old methods?
- Closed