示例#1
0
		/// <summary> Constructs with default analyzer and a map of analyzers to use for 
		/// specific fields.
		/// 
		/// </summary>
		/// <param name="defaultAnalyzer">Any fields not specifically
		/// defined to use a different analyzer will use the one provided here.
		/// </param>
		/// <param name="fieldAnalyzers">a Map (String field name to the Analyzer) to be 
		/// used for those fields 
		/// </param>
		public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer, System.Collections.IDictionary fieldAnalyzers)
		{
			this.defaultAnalyzer = defaultAnalyzer;
			if (fieldAnalyzers != null)
			{
				System.Collections.ArrayList keys = new System.Collections.ArrayList(fieldAnalyzers.Keys);
				System.Collections.ArrayList values = new System.Collections.ArrayList(fieldAnalyzers.Values);

				for (int i=0; i < keys.Count; i++)
					analyzerMap[keys[i]] = values[i];
			}
			SetOverridesTokenStreamMethod(typeof(PerFieldAnalyzerWrapper));
		}
示例#2
0
		/// <summary> Defines an analyzer to use for the specified field.
		/// 
		/// </summary>
		/// <param name="fieldName">field name requiring a non-default analyzer
		/// </param>
		/// <param name="analyzer">non-default analyzer to use for field
		/// </param>
		public virtual void  AddAnalyzer(System.String fieldName, Analyzer analyzer)
		{
			analyzerMap[fieldName] = analyzer;
		}
示例#3
0
		/// <summary> Constructs with default analyzer.
		/// 
		/// </summary>
		/// <param name="defaultAnalyzer">Any fields not specifically
		/// defined to use a different analyzer will use the one provided here.
		/// </param>
		public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer):this(defaultAnalyzer, null)
		{
		}