Method NewAnonymous
NewAnonymous(Func<String, TextReader, TokenStreamComponents>)
Creates a new instance with the ability to specify the body of the CreateComponents(String, TextReader)
method through the createComponents
parameter.
Simple example:
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);
});
LUCENENET specific
Declaration
public static Analyzer NewAnonymous(Func<string, TextReader, TokenStreamComponents> createComponents)
Parameters
Type | Name | Description |
---|---|---|
Func<System.String, TextReader, TokenStreamComponents> | createComponents | A delegate method that represents (is called by) the CreateComponents(String, TextReader)
method. It accepts a |
Returns
Type | Description |
---|---|
Analyzer | A new Lucene.Net.Analysis.Analyzer.AnonymousAnalyzer instance. |
NewAnonymous(Func<String, TextReader, TokenStreamComponents>, ReuseStrategy)
Creates a new instance with the ability to specify the body of the CreateComponents(String, TextReader)
method through the createComponents
parameter and allows the use of a ReuseStrategy.
Simple example:
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);
LUCENENET specific
Declaration
public static Analyzer NewAnonymous(Func<string, TextReader, TokenStreamComponents> createComponents, ReuseStrategy reuseStrategy)
Parameters
Type | Name | Description |
---|---|---|
Func<System.String, TextReader, TokenStreamComponents> | createComponents | An delegate method that represents (is called by) the CreateComponents(String, TextReader)
method. It accepts a |
ReuseStrategy | reuseStrategy | A custom ReuseStrategy instance. |
Returns
Type | Description |
---|---|
Analyzer | A new Lucene.Net.Analysis.Analyzer.AnonymousAnalyzer instance. |
NewAnonymous(Func<String, TextReader, TokenStreamComponents>, Func<String, TextReader, TextReader>)
Creates a new instance with the ability to specify the body of the CreateComponents(String, TextReader)
method through the createComponents
parameter and the body of the InitReader(String, TextReader)
method through the initReader
parameter.
Simple example:
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);
});
LUCENENET specific
Declaration
public static Analyzer NewAnonymous(Func<string, TextReader, TokenStreamComponents> createComponents, Func<string, TextReader, TextReader> initReader)
Parameters
Type | Name | Description |
---|---|---|
Func<System.String, TextReader, TokenStreamComponents> | createComponents | A delegate method that represents (is called by) the CreateComponents(String, TextReader)
method. It accepts a |
Func<System.String, TextReader, TextReader> | initReader | A delegate method that represents (is called by) the InitReader(String, TextReader)
method. It accepts a |
Returns
Type | Description |
---|---|
Analyzer | A new Lucene.Net.Analysis.Analyzer.AnonymousAnalyzer instance. |
NewAnonymous(Func<String, TextReader, TokenStreamComponents>, Func<String, TextReader, TextReader>, ReuseStrategy)
Creates a new instance with the ability to specify the body of the CreateComponents(String, TextReader)
method through the createComponents
parameter, the body of the InitReader(String, TextReader)
method through the initReader
parameter, and allows the use of a ReuseStrategy.
Simple example:
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);
LUCENENET specific
Declaration
public static Analyzer NewAnonymous(Func<string, TextReader, TokenStreamComponents> createComponents, Func<string, TextReader, TextReader> initReader, ReuseStrategy reuseStrategy)
Parameters
Type | Name | Description |
---|---|---|
Func<System.String, TextReader, TokenStreamComponents> | createComponents | A delegate method that represents (is called by) the CreateComponents(String, TextReader)
method. It accepts a |
Func<System.String, TextReader, TextReader> | initReader | A delegate method that represents (is called by) the InitReader(String, TextReader)
method. It accepts a |
ReuseStrategy | reuseStrategy | A custom ReuseStrategy instance. |
Returns
Type | Description |
---|---|
Analyzer | A new Lucene.Net.Analysis.Analyzer.AnonymousAnalyzer instance. |