public abstract class Feature extends Query
A feature consists of
Example configuration (snippet):
{ "class" : "...", "name" : "myFeature", "params" : { ... } }
Feature
is an abstract class and concrete classes should implement
the validate()
function, and must implement the paramsToMap()
and createWeight() methods.
Modifier and Type | Class and Description |
---|---|
class |
Feature.FeatureWeight
Weight for a feature
|
Constructor and Description |
---|
Feature(String name,
Map<String,Object> params) |
Modifier and Type | Method and Description |
---|---|
abstract Feature.FeatureWeight |
createWeight(IndexSearcher searcher,
boolean needsScores,
SolrQueryRequest request,
Query originalQuery,
Map<String,String[]> efi) |
boolean |
equals(Object o) |
float |
getDefaultValue() |
int |
getIndex() |
static Feature |
getInstance(SolrResourceLoader solrResourceLoader,
String className,
String name,
Map<String,Object> params) |
String |
getName() |
int |
hashCode() |
abstract LinkedHashMap<String,Object> |
paramsToMap() |
void |
setDefaultValue(String value) |
void |
setIndex(int index) |
String |
toString(String field) |
protected abstract void |
validate()
As part of creation of a feature instance, this function confirms
that the feature parameters are valid.
|
classHash, createWeight, rewrite, sameClassAs, toString
protected final String name
public static Feature getInstance(SolrResourceLoader solrResourceLoader, String className, String name, Map<String,Object> params)
protected abstract void validate() throws FeatureException
FeatureException
- Feature Exceptionpublic abstract Feature.FeatureWeight createWeight(IndexSearcher searcher, boolean needsScores, SolrQueryRequest request, Query originalQuery, Map<String,String[]> efi) throws IOException
IOException
public float getDefaultValue()
public void setDefaultValue(String value)
public String getName()
public int getIndex()
public void setIndex(int index)
index
- Unique ID for this feature. Similar to feature name, except it can
be used to directly access the feature in the global list of
features.public abstract LinkedHashMap<String,Object> paramsToMap()
Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.