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

it is impossible to use a custom dictionary for SmartChineseAnalyzer

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.9
    • modules/analysis
    • None
    • New, Patch Available

    Description

      it is not possible to use a custom dictionary, even though there is a lot of code and javadocs to allow this.

      This is because the custom dictionary is only loaded if it cannot load the built-in one (which is of course, in the jar file and should load)

      public synchronized static WordDictionary getInstance() {
          if (singleInstance == null) {
            singleInstance = new WordDictionary(); // load from jar file
            try {
              singleInstance.load();
            } catch (IOException e) { // loading from jar file must fail before it checks the AnalyzerProfile (where this can be configured)
              String wordDictRoot = AnalyzerProfile.ANALYSIS_DATA_DIR;
              singleInstance.load(wordDictRoot);
            } catch (ClassNotFoundException e) {
              throw new RuntimeException(e);
            }
          }
          return singleInstance;
        }
      

      I think we should either correct this, document this, or disable custom dictionary support...

      Attachments

        1. dataFiles.zip
          2.02 MB
          Robert Muir
        2. LUCENE-1817.patch
          18 kB
          Robert Muir
        3. LUCENE-1817.patch
          9 kB
          Robert Muir
        4. LUCENE-1817-mark-cn-experimental.patch
          16 kB
          Simon Willnauer

        Activity

          People

            rcmuir Robert Muir
            rcmuir Robert Muir
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: