org.apache.solr.search.similarities
Class SweetSpotSimilarityFactory

java.lang.Object
  extended by org.apache.solr.schema.SimilarityFactory
      extended by org.apache.solr.search.similarities.DefaultSimilarityFactory
          extended by org.apache.solr.search.similarities.SweetSpotSimilarityFactory

public class SweetSpotSimilarityFactory
extends DefaultSimilarityFactory

Factory for SweetSpotSimilarity.

SweetSpotSimilarity is an extension of DefaultSimilarity 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 DefaultSimilarityFactory The following sets of init params are supported by this factory:

Note:

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>
 

See Also:
The javadocs for the individual methods in SweetSpotSimilarity for SVG diagrams showing how the each function behaves with various settings/inputs.

Field Summary
 
Fields inherited from class org.apache.solr.search.similarities.DefaultSimilarityFactory
discountOverlaps
 
Fields inherited from class org.apache.solr.schema.SimilarityFactory
CLASS_NAME, params
 
Constructor Summary
SweetSpotSimilarityFactory()
           
 
Method Summary
 Similarity getSimilarity()
           
 void init(SolrParams params)
           
 
Methods inherited from class org.apache.solr.schema.SimilarityFactory
getClassArg, getNamedPropertyValues, getParams
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SweetSpotSimilarityFactory

public SweetSpotSimilarityFactory()
Method Detail

init

public void init(SolrParams params)
Overrides:
init in class DefaultSimilarityFactory

getSimilarity

public Similarity getSimilarity()
Overrides:
getSimilarity in class DefaultSimilarityFactory


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.