Bartosz Firyn created LUCENE-7971:
-------------------------------------

             Summary: Invalid example in SpellChecker javadoc
                 Key: LUCENE-7971
                 URL: https://issues.apache.org/jira/browse/LUCENE-7971
             Project: Lucene - Core
          Issue Type: Bug
          Components: modules/suggest
    Affects Versions: 6.6.1
            Reporter: Bartosz Firyn
            Priority: Trivial


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:

{code: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);
{code}

Instead of:

{code: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);
{code}

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.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to