[ 
https://issues.apache.org/jira/browse/LUCENE-7971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16168900#comment-16168900
 ] 

Bartosz Firyn commented on LUCENE-7971:
---------------------------------------

Pull request fixing this issue is available: 
https://github.com/apache/lucene-solr/pull/248

> 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
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> 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