net.sf.eos.lucene
Class SimilaritySupplier

java.lang.Object
  extended by net.sf.eos.lucene.SimilaritySupplier
All Implemented Interfaces:
Supplier<org.apache.lucene.search.Similarity>
Direct Known Subclasses:
NormedLengthSimilaritySupplier

public abstract class SimilaritySupplier
extends Object
implements Supplier<org.apache.lucene.search.Similarity>

To support different strategies of Similarity in a Lucene index this factory decoupled the creation of the Similarity from hard coded classnames. Set the classname of a factory different from default implementation. SIMILARITY_SUPPLIER_IMPL_CONFIG_NAME contains the name of the configuration key.

Implementations must have a default constructor and must implement get().

Author:
Sascha Kohlmann

Field Summary
static String SIMILARITY_SUPPLIER_IMPL_CONFIG_NAME
          The configuration key name for the classname of the factory.
 
Constructor Summary
SimilaritySupplier()
           
 
Method Summary
abstract  org.apache.lucene.search.Similarity get()
          Returns a new Similarity instance.
static SimilaritySupplier newInstance(Configuration config)
          Creates a new instance of a of the provider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIMILARITY_SUPPLIER_IMPL_CONFIG_NAME

@ConfigurationKey(type=CLASSNAME,
                  description="Configuration key of the Lucene similarity  factory.")
public static final String SIMILARITY_SUPPLIER_IMPL_CONFIG_NAME
The configuration key name for the classname of the factory.

See Also:
newInstance(Configuration), Constant Field Values
Constructor Detail

SimilaritySupplier

public SimilaritySupplier()
Method Detail

newInstance

@FactoryMethod(key="net.sf.eos.lucene.SimilaritySupplier.impl",
               implementation=NormedLengthSimilaritySupplier.class)
public static final SimilaritySupplier newInstance(Configuration config)
                                            throws EosException
Creates a new instance of a of the provider. If the Configuration contains a key SIMILARITY_SUPPLIER_IMPL_CONFIG_NAME a new instance of the classname in the value will instantiate. The NormedLengthSimilaritySupplier will instantiate if there is no value setted.

Parameters:
config - the configuration
Returns:
a new instance
Throws:
EosException - if it is not possible to instantiate an instance

get

public abstract org.apache.lucene.search.Similarity get()
Returns a new Similarity instance.

Specified by:
get in interface Supplier<org.apache.lucene.search.Similarity>
Returns:
a new Similarity instance


Copyright © 2008. All Rights Reserved.