Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-7971

Invalid example in SpellChecker javadoc

Details

    • Bug
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • 6.6.1
    • None
    • modules/suggest
    • None
    • New, Patch Available

    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:

      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:

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sarxos Bartosz Firyn
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0.25h
                  0.25h
                  Remaining:
                  Remaining Estimate - 0.25h
                  0.25h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified