public class SweetSpotSimilarityFactory extends ClassicSimilarityFactory
Factory for SweetSpotSimilarity
.
SweetSpotSimilarity
is an extension of
ClassicSimilarity
that provides additional tuning options for
specifying the "sweetspot" of optimal tf
and
lengthNorm
values in the source data.
In addition to the discountOverlaps
init param supported by
ClassicSimilarityFactory
The following sets of init params are
supported by this factory:
lengthNormMin
(int)lengthNormMax
(int)lengthNormSteepness
(float)baselineTfBase
(float)baselineTfMin
(float)hyperbolicTfMin
(float)hyperbolicTfMax
(float)hyperbolicTfBase
(double)hyperbolicTfOffset
(float)Note:
SweetSpotSimilarity.baselineTf(float)
or
SweetSpotSimilarity.hyperbolicTf(float)
will be used.
Example usage...
<!-- using baseline TF --> <fieldType name="text_baseline" class="solr.TextField" indexed="true" stored="false"> <analyzer class="org.apache.lucene.analysis.standard.StandardAnalyzer"/> <similarity class="solr.SweetSpotSimilarityFactory"> <!-- TF --> <float name="baselineTfMin">6.0</float> <float name="baselineTfBase">1.5</float> <!-- plateau norm --> <int name="lengthNormMin">3</int> <int name="lengthNormMax">5</int> <float name="lengthNormSteepness">0.5</float> </similarity> </fieldType> <!-- using hyperbolic TF --> <fieldType name="text_hyperbolic" class="solr.TextField" indexed="true" stored="false" > <analyzer class="org.apache.lucene.analysis.standard.StandardAnalyzer"/> <similarity class="solr.SweetSpotSimilarityFactory"> <float name="hyperbolicTfMin">3.3</float> <float name="hyperbolicTfMax">7.7</float> <double name="hyperbolicTfBase">2.718281828459045</double> <!-- e --> <float name="hyperbolicTfOffset">5.0</float> <!-- plateau norm, shallower slope --> <int name="lengthNormMin">1</int> <int name="lengthNormMax">5</int> <float name="lengthNormSteepness">0.2</float> </similarity> </fieldType>
DISCOUNT_OVERLAPS, discountOverlaps
CLASS_NAME, params
Constructor and Description |
---|
SweetSpotSimilarityFactory() |
Modifier and Type | Method and Description |
---|---|
Similarity |
getSimilarity() |
void |
init(SolrParams params) |
getClassArg, getNamedPropertyValues, getParams
public void init(SolrParams params)
init
in class ClassicSimilarityFactory
public Similarity getSimilarity()
getSimilarity
in class ClassicSimilarityFactory
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.