public abstract class AnalyzerProvider extends Service
analyzerName
and alternativeNames
that are specific to the constructor
of this base class. Sub-classes must have a public no-arg constructor such that they can be service-loaded.
Here is an example that implements an analyzer provider for the SwedishAnalyzer
that comes built into Lucene:
public class Swedish extends AnalyzerProvider
{
public Swedish()
{
super( "swedish" );
}
public Analyzer createAnalyzer()
{
return new SwedishAnalyzer();
}
}
The jar
that includes this implementation must also contain a META-INF/services/org.neo4j.graphdb.index.fulltext.AnalyzerProvider
file,
that contains the fully-qualified class names of all of the AnalyzerProvider
implementations it contains.
Service.Implementation
Constructor and Description |
---|
AnalyzerProvider(String analyzerName,
String... alternativeNames)
Sub-classes MUST have a public no-arg constructor, and must call this super-constructor with the names it uses to identify itself.
|
Modifier and Type | Method and Description |
---|---|
abstract org.apache.lucene.analysis.Analyzer |
createAnalyzer() |
static AnalyzerProvider |
getProviderByName(String analyzerName) |
public AnalyzerProvider(String analyzerName, String... alternativeNames)
Sub-classes should strive to make these names unique. If the names are not unique among all analyzer providers on the class path, then the indexes may fail to load the correct analyzers that they are configured with.
analyzerName
- The name of this analyzer provider, which will be used for analyzer settings values for identifying which implementation to use.alternativeNames
- The alternative names that can also be used to identify this analyzer provider.public static AnalyzerProvider getProviderByName(String analyzerName) throws NoSuchElementException
NoSuchElementException
public abstract org.apache.lucene.analysis.Analyzer createAnalyzer()
Analyzer
instance.Copyright © 2002–2018 The Neo4j Graph Database Project. All rights reserved.