@API(value=EXPERIMENTAL) public interface TextTokenizerRegistry
TextTokenizer
s. This registry allows for full-text indexes to specify
their tokenizer type through an index option, using the
"" option. The registry
will then be queried for the tokenizer that has that name at index- and query-time.
Note that there are two ways of adding elements to the tokenizer registry. The first
is to use the AutoService
annotation to mark
a TextTokenizerFactory
implementation as one that should be loaded into
the registry. The other is to call register()
on this interface to register that tokenizer manually. This second way is useful
for tokenizers that are built on the fly from configuration parameters, for example.
Modifier and Type | Method and Description |
---|---|
Map<String,TextTokenizerFactory> |
getRegistry()
Returns all registered tokenizers.
|
TextTokenizer |
getTokenizer(String name)
Gets the tokenizer of the given name.
|
void |
register(TextTokenizerFactory tokenizerFactory)
Registers a new tokenizer in this registry.
|
void |
reset()
Clears the registry and reloads tokenizers from the classpath.
|
@Nonnull TextTokenizer getTokenizer(@Nullable String name)
name
is null
,
it returns an instance of the DefaultTextTokenizer
.name
- the name of the tokenizer to retrieveMetaDataException
- if no such tokenizer existsvoid register(@Nonnull TextTokenizerFactory tokenizerFactory)
tokenizerFactory
parameter given.tokenizerFactory
- new tokenizer to registerRecordCoreArgumentException
- if there is a tokenizer of the same name already registered@Nonnull Map<String,TextTokenizerFactory> getRegistry()
TextTokenizerFactory
void reset()