Beispiel #1
0
 /// <summary>
 /// Expert: create a new Analyzer with a custom <see cref="ReuseStrategy"/>.
 /// <para/>
 /// NOTE: if you just want to reuse on a per-field basis, its easier to
 /// use a subclass of <see cref="AnalyzerWrapper"/> such as
 /// <c>Lucene.Net.Analysis.Common.Miscellaneous.PerFieldAnalyzerWrapper</c>
 /// instead.
 /// </summary>
 public Analyzer(ReuseStrategy reuseStrategy)
 {
     this.reuseStrategy = reuseStrategy;
 }
Beispiel #2
0
 public AnonymousAnalyzer(Func <string, TextReader, TokenStreamComponents> createComponents, Func <string, TextReader, TextReader> initReader, ReuseStrategy reuseStrategy)
     : base(reuseStrategy)
 {
     if (createComponents == null)
     {
         throw new ArgumentNullException("createComponents");
     }
     this.createComponents = createComponents;
     this.initReader       = initReader;
 }
Beispiel #3
0
 /// <summary>
 /// Creates a new instance with the ability to specify the body of the <see cref="CreateComponents(string, TextReader)"/>
 /// method through the <paramref name="createComponents"/> parameter, the body of the <see cref="InitReader(string, TextReader)"/>
 /// method through the <paramref name="initReader"/> parameter, and allows the use of a <see cref="ReuseStrategy"/>.
 /// Simple example:
 /// <code>
 ///     var analyzer = Analyzer.NewAnonymous(createComponents: (fieldName, reader) =>
 ///     {
 ///         Tokenizer source = new FooTokenizer(reader);
 ///         TokenStream filter = new FooFilter(source);
 ///         filter = new BarFilter(filter);
 ///         return new TokenStreamComponents(source, filter);
 ///     }, initReader: (fieldName, reader) =>
 ///     {
 ///         return new HTMLStripCharFilter(reader);
 ///     }, reuseStrategy);
 /// </code>
 /// <para/>
 /// LUCENENET specific
 /// </summary>
 /// <param name="createComponents">
 /// A delegate method that represents (is called by) the <see cref="CreateComponents(string, TextReader)"/>
 /// method. It accepts a <see cref="string"/> fieldName and a <see cref="TextReader"/> reader and
 /// returns the <see cref="TokenStreamComponents"/> for this analyzer.
 /// </param>
 /// <param name="initReader">A delegate method that represents (is called by) the <see cref="InitReader(string, TextReader)"/>
 /// method. It accepts a <see cref="string"/> fieldName and a <see cref="TextReader"/> reader and
 /// returns the <see cref="TextReader"/> that can be modified or wrapped by the <paramref name="initReader"/> method.</param>
 /// <param name="reuseStrategy">A custom <see cref="ReuseStrategy"/> instance.</param>
 /// <returns> A new <see cref="AnonymousAnalyzer"/> instance.</returns>
 public static Analyzer NewAnonymous(Func <string, TextReader, TokenStreamComponents> createComponents, Func <string, TextReader, TextReader> initReader, ReuseStrategy reuseStrategy)
 {
     return(new AnonymousAnalyzer(createComponents, initReader, reuseStrategy));
 }
Beispiel #4
0
 /// <summary>
 /// Creates a new instance with the ability to specify the body of the <see cref="CreateComponents(string, TextReader)"/>
 /// method through the <paramref name="createComponents"/> parameter and allows the use of a <see cref="ReuseStrategy"/>.
 /// Simple example:
 /// <code>
 ///     var analyzer = Analyzer.NewAnonymous(createComponents: (fieldName, reader) =>
 ///     {
 ///         Tokenizer source = new FooTokenizer(reader);
 ///         TokenStream filter = new FooFilter(source);
 ///         filter = new BarFilter(filter);
 ///         return new TokenStreamComponents(source, filter);
 ///     }, reuseStrategy);
 /// </code>
 /// <para/>
 /// LUCENENET specific
 /// </summary>
 /// <param name="createComponents">
 /// An delegate method that represents (is called by) the <see cref="CreateComponents(string, TextReader)"/>
 /// method. It accepts a <see cref="string"/> fieldName and a <see cref="TextReader"/> reader and
 /// returns the <see cref="TokenStreamComponents"/> for this analyzer.
 /// </param>
 /// <param name="reuseStrategy">A custom <see cref="ReuseStrategy"/> instance.</param>
 /// <returns> A new <see cref="AnonymousAnalyzer"/> instance.</returns>
 public static Analyzer NewAnonymous(Func <string, TextReader, TokenStreamComponents> createComponents, ReuseStrategy reuseStrategy)
 {
     return(NewAnonymous(createComponents, null, reuseStrategy));
 }
Beispiel #5
0
 /// <summary>
 /// Expert: create a new Analyzer with a custom <see cref="ReuseStrategy"/>.
 /// <para/>
 /// NOTE: if you just want to reuse on a per-field basis, its easier to
 /// use a subclass of <see cref="AnalyzerWrapper"/> such as
 /// <c>Lucene.Net.Analysis.Common.Miscellaneous.PerFieldAnalyzerWrapper</c>
 /// instead.
 /// </summary>
 protected Analyzer(ReuseStrategy reuseStrategy) // LUCENENET: CA1012: Abstract types should not have constructors (marked protected)
 {
     this.reuseStrategy = reuseStrategy;
 }
Beispiel #6
0
 /// <summary>
 /// Creates a new <see cref="AnalyzerWrapper"/> with the given reuse strategy.
 /// <para/>If you want to wrap a single delegate <see cref="Analyzer"/> you can probably
 /// reuse its strategy when instantiating this subclass:
 /// <c>base(innerAnalyzer.Strategy)</c>.
 /// <para/>If you choose different analyzers per field, use
 /// <see cref="Analyzer.PER_FIELD_REUSE_STRATEGY"/>.
 /// </summary>
 /// <seealso cref="Analyzer.Strategy"/>
 protected internal AnalyzerWrapper(ReuseStrategy reuseStrategy)
     : base(reuseStrategy)
 {
 }