Package org.apache.solr.ltr.feature
Class FieldLengthFeature
java.lang.Object
org.apache.lucene.search.Query
org.apache.solr.ltr.feature.Feature
org.apache.solr.ltr.feature.FieldLengthFeature
- All Implemented Interfaces:
org.apache.lucene.util.Accountable
This feature returns the length of a field (in terms) for the current document. Example
configuration:
{
"name": "titleLength",
"class": "org.apache.solr.ltr.feature.FieldLengthFeature",
"params": {
"field": "title"
}
}
Note: since this feature relies on norms values that are stored in a single byte the value of the
feature could have a lightly different value. (see also ClassicSimilarity)-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.solr.ltr.feature.Feature
Feature.FeatureWeight -
Field Summary
Fields 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
-
Constructor Details
-
FieldLengthFeature
-
-
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
-