Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new WordDelimiterFilter
 /// </summary>
 /// <param name="in"> TokenStream to be filtered </param>
 /// <param name="charTypeTable"> table containing character types </param>
 /// <param name="configurationFlags"> Flags configuring the filter </param>
 /// <param name="protWords"> If not null is the set of tokens to protect from being delimited </param>
 public WordDelimiterFilter(Version matchVersion, TokenStream @in, sbyte[] charTypeTable, int configurationFlags, CharArraySet protWords)
     : base(@in)
 {
     if (!InstanceFieldsInitialized)
       {
       InitializeInstanceFields();
       InstanceFieldsInitialized = true;
       }
     if (!matchVersion.onOrAfter(Version.LUCENE_48))
     {
       throw new System.ArgumentException("This class only works with Lucene 4.8+. To emulate the old (broken) behavior of WordDelimiterFilter, use Lucene47WordDelimiterFilter");
     }
     this.flags = configurationFlags;
     this.protWords = protWords;
     this.iterator = new WordDelimiterIterator(charTypeTable, has(SPLIT_ON_CASE_CHANGE), has(SPLIT_ON_NUMERICS), has(STEM_ENGLISH_POSSESSIVE));
 }
        /// <summary>
        /// Creates a new WordDelimiterFilter
        /// </summary>
        /// <param name="in"> TokenStream to be filtered </param>
        /// <param name="charTypeTable"> table containing character types </param>
        /// <param name="configurationFlags"> Flags configuring the filter </param>
        /// <param name="protWords"> If not null is the set of tokens to protect from being delimited </param>
        public Lucene47WordDelimiterFilter(TokenStream @in, sbyte[] charTypeTable, int configurationFlags, CharArraySet protWords)
            : base(@in)
        {
            termAttribute = AddAttribute<ICharTermAttribute>();
            offsetAttribute = AddAttribute<IOffsetAttribute>();
            posIncAttribute = AddAttribute<IPositionIncrementAttribute>();
            typeAttribute = AddAttribute<ITypeAttribute>();

            if (!InstanceFieldsInitialized)
            {
                InitializeInstanceFields();
                InstanceFieldsInitialized = true;
            }
            this.flags = configurationFlags;
            this.protWords = protWords;
            this.iterator = new WordDelimiterIterator(charTypeTable, has(SPLIT_ON_CASE_CHANGE), has(SPLIT_ON_NUMERICS), has(STEM_ENGLISH_POSSESSIVE));
        }