Similarity
A (global) <similarity> declaration can be used to specify a custom Similarity implementation that you want Solr to use when dealing with your index. A Similarity can be specified either by referring directly to the name of a class with a no-arg constructor...
<similarity class="org.apache.lucene.search.similarities.DefaultSimilarity"/>
...or by referencing a SimilarityFactory implementation, which may take optional init params....
<similarity class="solr.DFRSimilarityFactory"> <str name="basicModel">P</str> <str name="afterEffect">L</str> <str name="normalization">H2</str> <float name="c">7</float> </similarity>
Begining with Solr4.0, Similarity factories such as SchemaSimilarityFactory can also support specifying specific Similarity implementations on individual field types...
<types> <fieldType name="text_dfr" class="solr.TextField"> <analyzer class="org.apache.lucene.analysis.standard.StandardAnalyzer"/> <similarity class="solr.DFRSimilarityFactory"> <str name="basicModel">I(F)</str> <str name="afterEffect">B</str> <str name="normalization">H2</str> </similarity> </fieldType> <fieldType name="text_ib" class="solr.TextField"> <analyzer class="org.apache.lucene.analysis.standard.StandardAnalyzer"/> <similarity class="solr.IBSimilarityFactory"> <str name="distribution">SPL</str> <str name="lambda">DF</str> <str name="normalization">H2</str> </similarity> </fieldType> ... </types> <similarity class="solr.SchemaSimilarityFactory"/>
If no (global) <similarity> is configured in the schema.xml file, an implicit instance of DefaultSimilarityFactory is used.
Read full article from SchemaXml - Solr Wiki
No comments:
Post a Comment