You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Anna Björk Nikulásdóttir (JIRA)" <ji...@apache.org> on 2013/08/13 14:43:47 UTC

[jira] [Created] (LUCENE-5171) AnalyzingSuggester and FuzzySuggester should be able to share same FST

Anna Björk Nikulásdóttir created LUCENE-5171:
------------------------------------------------

             Summary: AnalyzingSuggester and FuzzySuggester should be able to share same FST
                 Key: LUCENE-5171
                 URL: https://issues.apache.org/jira/browse/LUCENE-5171
             Project: Lucene - Core
          Issue Type: Improvement
          Components: modules/other
    Affects Versions: 4.3.1, 4.4
            Reporter: Anna Björk Nikulásdóttir


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);




--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org