Package org.apache.solr.ltr.feature
Class Feature.FeatureWeight
java.lang.Object
org.apache.lucene.search.Weight
org.apache.solr.ltr.feature.Feature.FeatureWeight
- All Implemented Interfaces:
org.apache.lucene.search.SegmentCacheable
- Direct Known Subclasses:
FieldLengthFeature.FieldLengthFeatureWeight,FieldValueFeature.FieldValueFeatureWeight,OriginalScoreFeature.OriginalScoreWeight,SolrFeature.SolrFeatureWeight,ValueFeature.ValueFeatureWeight
- Enclosing class:
Feature
public abstract class Feature.FeatureWeight
extends org.apache.lucene.search.Weight
Weight for a feature
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA 'recipe' for computing a featurestatic classAFeatureScorerthat contains aScorer, which it delegates to where appropriate.static classDefault FeatureScorer class that returns the score passed in.Nested classes/interfaces inherited from class org.apache.lucene.search.Weight
org.apache.lucene.search.Weight.DefaultBulkScorer, org.apache.lucene.search.Weight.DefaultScorerSupplier -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final MacroExpanderprotected final org.apache.lucene.search.Queryprotected final SolrQueryRequestprotected final org.apache.lucene.search.IndexSearcherFields inherited from class org.apache.lucene.search.Weight
parentQuery -
Constructor Summary
ConstructorsConstructorDescriptionFeatureWeight(org.apache.lucene.search.Query q, org.apache.lucene.search.IndexSearcher searcher, SolrQueryRequest request, org.apache.lucene.search.Query originalQuery, Map<String, String[]> efi) Initialize a feature without the normalizer from the feature file. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.lucene.search.Explanationexplain(org.apache.lucene.index.LeafReaderContext context, int doc) abstract Feature.FeatureWeight.FeatureScorerfeatureScorer(org.apache.lucene.index.LeafReaderContext context) floatintgetIndex()getName()booleanisCacheable(org.apache.lucene.index.LeafReaderContext ctx) org.apache.lucene.search.ScorerSupplierscorerSupplier(org.apache.lucene.index.LeafReaderContext context) toString()Used in the FeatureWeight's explain.Methods inherited from class org.apache.lucene.search.Weight
bulkScorer, count, getQuery, matches, scorer
-
Field Details
-
searcher
protected final org.apache.lucene.search.IndexSearcher searcher -
request
-
efi
-
macroExpander
-
originalQuery
protected final org.apache.lucene.search.Query originalQuery
-
-
Constructor Details
-
FeatureWeight
public FeatureWeight(org.apache.lucene.search.Query q, org.apache.lucene.search.IndexSearcher searcher, SolrQueryRequest request, org.apache.lucene.search.Query originalQuery, Map<String, String[]> efi) Initialize a feature without the normalizer from the feature file. This is called on initial construction since multiple models share the same features, but have different normalizers. A concrete model's feature is copied through featForNewModel().- Parameters:
q- Solr query associated with this FeatureWeightsearcher- Solr searcher available for features if they need them
-
-
Method Details
-
getName
-
getIndex
public int getIndex() -
getDefaultValue
public float getDefaultValue() -
featureScorer
public abstract Feature.FeatureWeight.FeatureScorer featureScorer(org.apache.lucene.index.LeafReaderContext context) throws IOException - Throws:
IOException
-
scorerSupplier
public org.apache.lucene.search.ScorerSupplier scorerSupplier(org.apache.lucene.index.LeafReaderContext context) throws IOException - Specified by:
scorerSupplierin classorg.apache.lucene.search.Weight- Throws:
IOException
-
isCacheable
public boolean isCacheable(org.apache.lucene.index.LeafReaderContext ctx) -
explain
public org.apache.lucene.search.Explanation explain(org.apache.lucene.index.LeafReaderContext context, int doc) throws IOException - Specified by:
explainin classorg.apache.lucene.search.Weight- Throws:
IOException
-
toString
Used in the FeatureWeight's explain. Each feature should implement this returning properties of the specific scorer useful for an explain. For example "MyCustomClassFeature [name=" + name + "myVariable:" + myVariable + "]"; If not provided, a default implementation will return basic feature properties, which might not include query time specific values.
-