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
- Direct Known Subclasses:
LegacyFieldValueFeature
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 if docValues=false
NumericDocValuesFVFS: used for docValues=true, if docValueType == NUMERIC
SortedDocValuesFVFS: used for docValues=true, if docValueType == SORTED
DefaultValueFVFS: used for docValues=true, a fallback scorer that is used on segments where no document has a value set in the field of this feature
Use LegacyFieldValueFeature for the pre 9.4 behaviour of not using DocValues when
docValues=true is combined with stored=true.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.solr.ltr.feature.Feature
Feature.FeatureWeight -
Field Summary
FieldsFields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateWeight(org.apache.lucene.search.IndexSearcher searcher, boolean needsScores, SolrQueryRequest request, org.apache.lucene.search.Query originalQuery, Map<String, String[]> efi) getField()voidprotected voidvalidate()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, visitMethods inherited from class org.apache.lucene.search.Query
classHash, createWeight, rewrite, sameClassAs, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Field Details
-
useDocValuesForStored
protected boolean useDocValuesForStored
-
-
Constructor Details
-
FieldValueFeature
-
-
Method Details
-
getField
-
setField
-
paramsToMap
- Specified by:
paramsToMapin classFeature
-
validate
Description copied from class:FeatureAs part of creation of a feature instance, this function confirms that the feature parameters are valid.- Specified by:
validatein 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:
createWeightin classFeature- Throws:
IOException
-