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

AnalyzingSuggester and FuzzySuggester should be able to share same FST

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.4, 4.3.1
    • Fix Version/s: None
    • Component/s: modules/other
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      In my code I use both suggesters for the same FST. I use AnalyzerSuggester#store() to create the FST and later on AnalyzingSuggester#load() and FuzzySuggester#load() to use it.
      This approach works very well but it unnecessarily creates 2 fst instances resulting in 2x memory consumption.

      It seems that for the time being both suggesters use the same FST format.

      The following trivial method in AnalyzingSuggester provides the possibility to share the same FST among different instances of AnalyzingSuggester. It has been tested in the above scenario:

      public boolean shareFstFrom(AnalyzingSuggester instance)
      {
      if (instance.fst == null)

      { return false; }

      this.fst = instance.fst;
      this.maxAnalyzedPathsForOneInput = instance.maxAnalyzedPathsForOneInput;
      this.hasPayloads = instance.hasPayloads;

      return true;
      }

      One could use it like this:

      analyzingSugg = new AnalyzingSuggester(...);
      fuzzySugg = new FuzzySuggester(...);
      analyzingSugg.load(someInputStream);
      fuzzySugg = analyzingSugg.shareFstFrom(analyzingSugg);

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              annanik Anna Björk Nikulásdóttir
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: