org.apache.solr.schema

## Class SimilarityFactory

- java.lang.Object
- - org.apache.solr.schema.SimilarityFactory

- Direct Known Subclasses:
    BM25SimilarityFactory, ClassicSimilarityFactory, DFISimilarityFactory, DFRSimilarityFactory, IBSimilarityFactory, LMDirichletSimilarityFactory, LMJelinekMercerSimilarityFactory, SchemaSimilarityFactory

      public abstract class SimilarityFactory
      extends Object

  A factory interface for configuring a `Similarity` in the Solr schema.xml.

  Subclasses of `SimilarityFactory` which are `SchemaAware` must take responsibility for either consulting the similarities configured on individual field types, or generating appropriate error/warning messages if field type specific similarities exist but are being ignored. The `IndexSchema` will provide such error checking if a non-`SchemaAware` instance of `SimilarityFactory` is used.

  See Also:
    `FieldType.getSimilarity()`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CLASS_NAME`
    `protected SolrParams` | `params`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimilarityFactory()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getClassArg()`
    `SimpleOrderedMap<Object>` | `getNamedPropertyValues()` Returns a serializable description of this similarity(factory)
    `SolrParams` | `getParams()`
    `abstract Similarity` | `getSimilarity()`
    `void` | `init(SolrParams params)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### CLASS_NAME

          public static final String CLASS_NAME

      See Also:
        Constant Field Values

    - #### params

          protected SolrParams params

  - ### Constructor Detail

    - #### SimilarityFactory

          public SimilarityFactory()

  - ### Method Detail

    - #### init

          public void init(SolrParams params)

    - #### getParams

          public SolrParams getParams()

    - #### getSimilarity

          public abstract Similarity getSimilarity()

    - #### getNamedPropertyValues

          public SimpleOrderedMap<Object> getNamedPropertyValues()

      Returns a serializable description of this similarity(factory)

    - #### getClassArg

          public String getClassArg()

      Returns:
        the string used to specify the concrete class name in a serialized representation: the class arg. If the concrete class name was not specified via a class arg, returns `getClass().getName()`, unless this class is the anonymous similarity wrapper produced in `IndexSchema`, in which case the `getSimilarity().getClass().getName()` is returned.

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