Lucene.Net.Analysis.Analyzer.GetPositionIncrementGap C# (CSharp) Method

GetPositionIncrementGap() public method

Invoked before indexing a IndexableField instance if terms have already been added to that field. this allows custom analyzers to place an automatic position increment gap between IndexbleField instances using the same field name. The default value position increment gap is 0. With a 0 position increment gap and the typical default token position increment of 1, all terms in a field, including across IndexableField instances, are in successive positions, allowing exact PhraseQuery matches, for instance, across IndexableField instance boundaries.
public GetPositionIncrementGap ( string fieldName ) : int
fieldName string IndexableField name being indexed.
return int
        public virtual int GetPositionIncrementGap(string fieldName)
        {
            return 0;
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>Return the positionIncrementGap from the analyzer assigned to fieldName </summary>
        public override int GetPositionIncrementGap(System.String fieldName)
        {
            Analyzer analyzer = (Analyzer)analyzerMap[fieldName];

            if (analyzer == null)
            {
                analyzer = defaultAnalyzer;
            }
            return(analyzer.GetPositionIncrementGap(fieldName));
        }