public abstract class Feature extends Query implements Accountable
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
|
Modifier and Type | Field and Description |
---|---|
protected String |
name |
NULL_ACCOUNTABLE
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) |
protected LinkedHashMap<String,Object> |
defaultParamsToMap() |
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() |
long |
ramBytesUsed() |
void |
setDefaultValue(Object obj) |
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.
|
void |
visit(QueryVisitor visitor) |
classHash, createWeight, rewrite, sameClassAs, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getChildResources
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(Object obj)
public long ramBytesUsed()
ramBytesUsed
in interface Accountable
public void visit(QueryVisitor visitor)
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()
protected LinkedHashMap<String,Object> defaultParamsToMap()
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.