19 using System.Collections;
20 using System.Collections.Generic;
21 using Lucene.Net.Analysis;
22 using Lucene.Net.Util;
25 namespace Lucene.Net.Analysis.Standard
44 private ISet<string> stopSet;
49 private bool replaceInvalidAcronym, enableStopPositionIncrements;
61 : this(matchVersion, STOP_WORDS_SET)
73 SetOverridesTokenStreamMethod<StandardAnalyzer>();
75 replaceInvalidAcronym = matchVersion.OnOrAfter(
Version.LUCENE_24);
76 this.matchVersion = matchVersion;
113 result =
new StopFilter(enableStopPositionIncrements, result, stopSet);
117 private sealed
class SavedStreams
124 public const int DEFAULT_MAX_TOKEN_LENGTH = 255;
126 private int maxTokenLength = DEFAULT_MAX_TOKEN_LENGTH;
133 public virtual int MaxTokenLength
135 get {
return maxTokenLength; }
136 set { maxTokenLength = value; }
139 public override TokenStream ReusableTokenStream(System.String fieldName, System.IO.TextReader reader)
141 if (overridesTokenStreamMethod)
148 SavedStreams streams = (SavedStreams) PreviousTokenStream;
151 streams =
new SavedStreams();
152 PreviousTokenStream = streams;
154 streams.filteredTokenStream =
new StandardFilter(streams.tokenStream);
155 streams.filteredTokenStream =
new LowerCaseFilter(streams.filteredTokenStream);
156 streams.filteredTokenStream =
new StopFilter(enableStopPositionIncrements,
157 streams.filteredTokenStream, stopSet);
161 streams.tokenStream.Reset(reader);
163 streams.tokenStream.MaxTokenLength = maxTokenLength;
165 streams.tokenStream.SetReplaceInvalidAcronym(replaceInvalidAcronym);
167 return streams.filteredTokenStream;