Package org.apache.solr.ltr.feature
Class Feature
- java.lang.Object
- 
- org.apache.lucene.search.Query
- 
- org.apache.solr.ltr.feature.Feature
 
 
- 
- All Implemented Interfaces:
- org.apache.lucene.util.Accountable
 - Direct Known Subclasses:
- FieldLengthFeature,- FieldValueFeature,- OriginalScoreFeature,- SolrFeature,- ValueFeature
 
 public abstract class Feature extends org.apache.lucene.search.Query implements org.apache.lucene.util.AccountableA recipe for computing a feature. Subclass this for specialized feature calculations.A feature consists of - a name as the identifier
- parameters to represent the specific feature
 Example configuration (snippet): { "class" : "...", "name" : "myFeature", "params" : { ... } }Featureis an abstract class and concrete classes should implement thevalidate()function, and must implement theparamsToMap()and createWeight() methods.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classFeature.FeatureWeightWeight for a feature
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Feature.FeatureWeightcreateWeight(org.apache.lucene.search.IndexSearcher searcher, boolean needsScores, SolrQueryRequest request, org.apache.lucene.search.Query originalQuery, Map<String,String[]> efi)protected LinkedHashMap<String,Object>defaultParamsToMap()booleanequals(Object o)floatgetDefaultValue()intgetIndex()static FeaturegetInstance(SolrResourceLoader solrResourceLoader, String className, String name, Map<String,Object> params)StringgetName()inthashCode()abstract LinkedHashMap<String,Object>paramsToMap()longramBytesUsed()voidsetDefaultValue(Object obj)voidsetIndex(int index)StringtoString(String field)protected abstract voidvalidate()As part of creation of a feature instance, this function confirms that the feature parameters are valid.voidvisit(org.apache.lucene.search.QueryVisitor visitor)- 
Methods inherited from class org.apache.lucene.search.QueryclassHash, createWeight, rewrite, sameClassAs, toString
 
- 
 
- 
- 
- 
Field Detail- 
nameprotected final String name 
 
- 
 - 
Method Detail- 
getInstancepublic static Feature getInstance(SolrResourceLoader solrResourceLoader, String className, String name, Map<String,Object> params) 
 - 
validateprotected abstract void validate() throws FeatureExceptionAs part of creation of a feature instance, this function confirms that the feature parameters are valid.- Throws:
- FeatureException- Feature Exception
 
 - 
toStringpublic String toString(String field) - Specified by:
- toStringin class- org.apache.lucene.search.Query
 
 - 
createWeightpublic abstract Feature.FeatureWeight createWeight(org.apache.lucene.search.IndexSearcher searcher, boolean needsScores, SolrQueryRequest request, org.apache.lucene.search.Query originalQuery, Map<String,String[]> efi) throws IOException - Throws:
- IOException
 
 - 
getDefaultValuepublic float getDefaultValue() 
 - 
setDefaultValuepublic void setDefaultValue(Object obj) 
 - 
hashCodepublic int hashCode() - Specified by:
- hashCodein class- org.apache.lucene.search.Query
 
 - 
equalspublic boolean equals(Object o) - Specified by:
- equalsin class- org.apache.lucene.search.Query
 
 - 
ramBytesUsedpublic long ramBytesUsed() - Specified by:
- ramBytesUsedin interface- org.apache.lucene.util.Accountable
 
 - 
visitpublic void visit(org.apache.lucene.search.QueryVisitor visitor) - Specified by:
- visitin class- org.apache.lucene.search.Query
 
 - 
getNamepublic String getName() - Returns:
- the name
 
 - 
getIndexpublic int getIndex() - Returns:
- the id
 
 - 
setIndexpublic void setIndex(int index) - Parameters:
- 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.
 
 - 
paramsToMappublic abstract LinkedHashMap<String,Object> paramsToMap() 
 - 
defaultParamsToMapprotected LinkedHashMap<String,Object> defaultParamsToMap() 
 
- 
 
-