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

it is impossible to use a custom dictionary for SmartChineseAnalyzer

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.9
    • Component/s: modules/analysis
    • Labels:
      None
    • Lucene Fields:
      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. LUCENE-1817-mark-cn-experimental.patch
          16 kB
          Simon Willnauer
        2. LUCENE-1817.patch
          9 kB
          Robert Muir
        3. dataFiles.zip
          2.02 MB
          Robert Muir
        4. LUCENE-1817.patch
          18 kB
          Robert Muir

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: