public class SchemaSimilarityFactory extends SimilarityFactory implements SolrCoreAware
SimilarityFactory that returns a global PerFieldSimilarityWrapper
that delegates to the field type, if it's configured. For field type's that
do not have a Similarity explicitly configured, the global Similarity
will use per fieldtype defaults -- either based on an explicitly configured
defaultSimFromFieldType of an implicit ClassicSimilarity.
The defaultSimFromFieldType option accepts the name of any fieldtype, and uses
whatever Similarity is explicitly configured for that fieldType as thedefault for
all other field types. For example:
<similarity class="solr.SchemaSimilarityFactory" >
<str name="defaultSimFromFieldType">type-using-custom-dfr</str>
</similarity>
...
<fieldType name="type-using-custom-dfr" class="solr.TextField">
...
<similarity class="solr.DFRSimilarityFactory">
<str name="basicModel">I(F)</str>
<str name="afterEffect">B</str>
<str name="normalization">H3</str>
<float name="mu">900</float>
</similarity>
</fieldType>
In the example above, any fieldtypes that do not define their own </similarity/>
will use the Similarity configured for the type-using-custom-dfr.
NOTE: Users should be aware that even when this factory uses a single default
Similarity for some or all fields in a Query, the behavior can be inconsistent
with the behavior of explicitly configuring that same Similarity globally, because
of differences in how some multi-field / multi-clause behavior is defined in
PerFieldSimilarityWrapper. In particular please consider carefully the documentation
& implementation of Similarity.coord(int, int) and Similarity.queryNorm(float) in
ClassicSimilarity compared to PerFieldSimilarityWrapper
FieldType.getSimilarity()CLASS_NAME, params| Constructor and Description |
|---|
SchemaSimilarityFactory() |
| Modifier and Type | Method and Description |
|---|---|
Similarity |
getSimilarity() |
void |
inform(SolrCore core) |
void |
init(SolrParams args) |
getClassArg, getNamedPropertyValues, getParamspublic void inform(SolrCore core)
inform in interface SolrCoreAwarepublic void init(SolrParams args)
init in class SimilarityFactorypublic Similarity getSimilarity()
getSimilarity in class SimilarityFactoryCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.