11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Similarity<br />

Similarity is a Lucene class used to score a document in searching.<br />

Each collection has one "global" Similarity, and by default <strong>Solr</strong> uses an implicit SchemaSimilarityFactory w<br />

hich allows individual field types to be configured with a "per-type" specific Similarity and implicitly uses BM25Sim<br />

ilarity for any field type which does not have an explicit Similarity.<br />

This default behavior can be overridden by declaring a top level element in your schema.xml,<br />

outside of any single field type. This similarity declaration can either refer directly to the name of a class with a<br />

no-argument constructor, such as in this example showing BM25Similarity:<br />

<br />

or by referencing a SimilarityFactory implementation, which may take optional initialization parameters:<br />

<br />

P<br />

L<br />

H2<br />

7<br />

<br />

In most cases, specifying global level similarity like this will cause an error if your schema.xml also includes<br />

field type specific declarations. One key exception to this is that you may explicitly declare a S<br />

chemaSimilarityFactory and specify what that default behavior will be for all field types that do not declare<br />

an explicit Similarity using the name of field type (specified by defaultSimFromFieldType) that is configured<br />

with a specific similarity:<br />

<br />

text_dfr<br />

<br />

<br />

<br />

<br />

I(F)<br />

B<br />

H3<br />

900<br />

<br />

<br />

<br />

<br />

<br />

SPL<br />

DF<br />

H2<br />

<br />

<br />

<br />

<br />

<br />

In the example above IBSimilarityFactory (using the Information-Based model) will be used for any fields<br />

of type text_ib, while DFRSimilarityFactory (divergence from random) will be used for any fields of type t<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

71

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!