Package org.apache.solr.ltr.feature
Class FieldValueFeature
- java.lang.Object
-
- org.apache.lucene.search.Query
-
- org.apache.solr.ltr.feature.Feature
-
- org.apache.solr.ltr.feature.FieldValueFeature
-
- All Implemented Interfaces:
org.apache.lucene.util.Accountable
public class FieldValueFeature extends Feature
This feature returns the value of a field in the current document. The field must have stored="true" or docValues="true" properties. Example configuration:{ "name": "rawHits", "class": "org.apache.solr.ltr.feature.FieldValueFeature", "params": { "field": "hits" } }
There are 4 different types of FeatureScorers that a FieldValueFeatureWeight may use. The chosen scorer depends on the field attributes.
FieldValueFeatureScorer (FVFS): used for stored=true, no matter if docValues=true or docValues=false
NumericDocValuesFVFS: used for stored=false and docValues=true, if docValueType == NUMERIC
SortedDocValuesFVFS: used for stored=false and docValues=true, if docValueType == SORTED
DefaultValueFVFS: used for stored=false and docValues=true, a fallback scorer that is used on segments where no document has a value set in the field of this feature
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
FieldValueFeature.FieldValueFeatureWeight
-
Nested classes/interfaces inherited from class org.apache.solr.ltr.feature.Feature
Feature.FeatureWeight
-
-
Constructor Summary
Constructors Constructor Description FieldValueFeature(String name, Map<String,Object> params)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Feature.FeatureWeight
createWeight(org.apache.lucene.search.IndexSearcher searcher, boolean needsScores, SolrQueryRequest request, org.apache.lucene.search.Query originalQuery, Map<String,String[]> efi)
String
getField()
LinkedHashMap<String,Object>
paramsToMap()
void
setField(String field)
protected void
validate()
As part of creation of a feature instance, this function confirms that the feature parameters are valid.-
Methods inherited from class org.apache.solr.ltr.feature.Feature
defaultParamsToMap, equals, getDefaultValue, getIndex, getInstance, getName, hashCode, ramBytesUsed, setDefaultValue, setIndex, toString, visit
-
Methods inherited from class org.apache.lucene.search.Query
classHash, createWeight, rewrite, sameClassAs, toString
-
-
-
-
Method Detail
-
getField
public String getField()
-
setField
public void setField(String field)
-
paramsToMap
public LinkedHashMap<String,Object> paramsToMap()
- Specified by:
paramsToMap
in classFeature
-
validate
protected void validate() throws FeatureException
Description copied from class:Feature
As part of creation of a feature instance, this function confirms that the feature parameters are valid.- Specified by:
validate
in classFeature
- Throws:
FeatureException
- Feature Exception
-
createWeight
public 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
- Specified by:
createWeight
in classFeature
- Throws:
IOException
-
-