Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class SynonymFilterFactory

    Factory for SynonymFilter.

    <fieldType name="text_synonym" class="solr.TextField" positionIncrementGap="100">
      <analyzer>
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" 
                format="solr" ignoreCase="false" expand="true" 
                tokenizerFactory="solr.WhitespaceTokenizerFactory"
                [optional tokenizer factory parameters]/>
      </analyzer>
    </fieldType>

    An optional param name prefix of "tokenizerFactory." may be used for any init params that the SynonymFilterFactory needs to pass to the specified TokenizerFactory. If the TokenizerFactory expects an init parameters with the same name as an init param used by the SynonymFilterFactory, the prefix is mandatory.

    The optional format parameter controls how the synonyms will be parsed: It supports the short names of solr for SolrSynonymParser and wordnet for and WordnetSynonymParser, or your own SynonymMap.Parser class name. The default is solr. A custom SynonymMap.Parser is expected to have a constructor taking:

    • bool dedup - true if duplicates should be ignored, false otherwise
    • bool expand - true if conflation groups should be expanded, false if they are one-directional
    • Lucene.Net.Analysis.Analyzer analyzer - an analyzer used for each raw synonym
    Inheritance
    object
    AbstractAnalysisFactory
    TokenFilterFactory
    SynonymFilterFactory
    Implements
    IResourceLoaderAware
    Inherited Members
    TokenFilterFactory.ForName(string, IDictionary<string, string>)
    TokenFilterFactory.LookupClass(string)
    TokenFilterFactory.AvailableTokenFilters
    TokenFilterFactory.ReloadTokenFilters()
    AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM
    AbstractAnalysisFactory.m_luceneMatchVersion
    AbstractAnalysisFactory.OriginalArgs
    AbstractAnalysisFactory.AssureMatchVersion()
    AbstractAnalysisFactory.LuceneMatchVersion
    AbstractAnalysisFactory.Require(IDictionary<string, string>, string)
    AbstractAnalysisFactory.Require(IDictionary<string, string>, string, ICollection<string>)
    AbstractAnalysisFactory.Require(IDictionary<string, string>, string, ICollection<string>, bool)
    AbstractAnalysisFactory.Get(IDictionary<string, string>, string, string)
    AbstractAnalysisFactory.Get(IDictionary<string, string>, string, ICollection<string>)
    AbstractAnalysisFactory.Get(IDictionary<string, string>, string, ICollection<string>, string)
    AbstractAnalysisFactory.Get(IDictionary<string, string>, string, ICollection<string>, string, bool)
    AbstractAnalysisFactory.RequireInt32(IDictionary<string, string>, string)
    AbstractAnalysisFactory.GetInt32(IDictionary<string, string>, string, int)
    AbstractAnalysisFactory.RequireBoolean(IDictionary<string, string>, string)
    AbstractAnalysisFactory.GetBoolean(IDictionary<string, string>, string, bool)
    AbstractAnalysisFactory.RequireSingle(IDictionary<string, string>, string)
    AbstractAnalysisFactory.GetSingle(IDictionary<string, string>, string, float)
    AbstractAnalysisFactory.RequireChar(IDictionary<string, string>, string)
    AbstractAnalysisFactory.GetChar(IDictionary<string, string>, string, char)
    AbstractAnalysisFactory.GetSet(IDictionary<string, string>, string)
    AbstractAnalysisFactory.GetPattern(IDictionary<string, string>, string)
    AbstractAnalysisFactory.GetCulture(IDictionary<string, string>, string, CultureInfo)
    AbstractAnalysisFactory.GetWordSet(IResourceLoader, string, bool)
    AbstractAnalysisFactory.GetLines(IResourceLoader, string)
    AbstractAnalysisFactory.GetSnowballWordSet(IResourceLoader, string, bool)
    AbstractAnalysisFactory.SplitFileNames(string)
    AbstractAnalysisFactory.GetClassArg()
    AbstractAnalysisFactory.IsExplicitLuceneMatchVersion
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Analysis.Synonym
    Assembly: Lucene.Net.Analysis.Common.dll
    Syntax
    public class SynonymFilterFactory : TokenFilterFactory, IResourceLoaderAware

    Constructors

    SynonymFilterFactory(IDictionary<string, string>)

    Factory for SynonymFilter.

    <fieldType name="text_synonym" class="solr.TextField" positionIncrementGap="100">
      <analyzer>
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" 
                format="solr" ignoreCase="false" expand="true" 
                tokenizerFactory="solr.WhitespaceTokenizerFactory"
                [optional tokenizer factory parameters]/>
      </analyzer>
    </fieldType>

    An optional param name prefix of "tokenizerFactory." may be used for any init params that the SynonymFilterFactory needs to pass to the specified TokenizerFactory. If the TokenizerFactory expects an init parameters with the same name as an init param used by the SynonymFilterFactory, the prefix is mandatory.

    The optional format parameter controls how the synonyms will be parsed: It supports the short names of solr for SolrSynonymParser and wordnet for and WordnetSynonymParser, or your own SynonymMap.Parser class name. The default is solr. A custom SynonymMap.Parser is expected to have a constructor taking:

    • bool dedup - true if duplicates should be ignored, false otherwise
    • bool expand - true if conflation groups should be expanded, false if they are one-directional
    • Lucene.Net.Analysis.Analyzer analyzer - an analyzer used for each raw synonym
    Declaration
    public SynonymFilterFactory(IDictionary<string, string> args)
    Parameters
    Type Name Description
    IDictionary<string, string> args

    Methods

    Create(TokenStream)

    Transform the specified input Lucene.Net.Analysis.TokenStream

    Declaration
    public override TokenStream Create(TokenStream input)
    Parameters
    Type Name Description
    TokenStream input
    Returns
    Type Description
    TokenStream
    Overrides
    TokenFilterFactory.Create(TokenStream)

    Inform(IResourceLoader)

    Initializes this component with the provided IResourceLoader (used for loading types, embedded resources, files, etc).

    Declaration
    public virtual void Inform(IResourceLoader loader)
    Parameters
    Type Name Description
    IResourceLoader loader

    Implements

    IResourceLoaderAware
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.