public class SimilarityModule extends AbstractModule
SimilarityModule
is responsible gathering registered and configured SimilarityProvider
implementations and making them available through the SimilarityLookupService
and SimilarityService
.
New SimilarityProvider
implementations can be registered through addSimilarity(String, Class)
while existing Providers can be referenced through Settings under the SIMILARITY_SETTINGS_PREFIX
prefix
along with the "type" value. For example, to reference the BM25SimilarityProvider
, the configuration
"index.similarity.my_similarity.type : "BM25" can be used.Modifier and Type | Field and Description |
---|---|
static String |
SIMILARITY_SETTINGS_PREFIX |
Constructor and Description |
---|
SimilarityModule(Settings settings) |
Modifier and Type | Method and Description |
---|---|
void |
addSimilarity(String name,
Class<? extends SimilarityProvider> similarity)
Registers the given
SimilarityProvider with the given name |
protected void |
configure()
Configures a
Binder via the exposed methods. |
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
public static final String SIMILARITY_SETTINGS_PREFIX
public SimilarityModule(Settings settings)
public void addSimilarity(String name, Class<? extends SimilarityProvider> similarity)
SimilarityProvider
with the given namename
- Name of the SimilarityProvidersimilarity
- SimilarityProvider to registerprotected void configure()
AbstractModule
Binder
via the exposed methods.configure
in class AbstractModule
Copyright © 2009–2017. All rights reserved.