Package org.apache.solr.ltr.model
Class WrapperModel
- java.lang.Object
- 
- org.apache.solr.ltr.model.LTRScoringModel
- 
- org.apache.solr.ltr.model.AdapterModel
- 
- org.apache.solr.ltr.model.WrapperModel
 
 
 
- 
- Direct Known Subclasses:
- DefaultWrapperModel
 
 public abstract class WrapperModel extends AdapterModel A scoring model that wraps the other model.This model loads a model from an external resource during the initialization. The way of fetching the wrapped model is depended on the implementation of fetchModelMap().This model doesn't hold the actual parameters of the wrapped model, thus it can manage large models which are difficult to upload to ZooKeeper. Example configuration: { "class": "...", "name": "myModelName", "params": { ... } }NOTE: no "features" are configured in the wrapper model because the wrapped model's features will be used instead. Also note that if a "store" is configured for the wrapper model then it must match the "store" of the wrapped model. 
- 
- 
Field SummaryFields Modifier and Type Field Description protected LTRScoringModelmodel- 
Fields inherited from class org.apache.solr.ltr.model.AdapterModelsolrResourceLoader
 - 
Fields inherited from class org.apache.solr.ltr.model.LTRScoringModelfeatures, name, norms
 
- 
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)org.apache.lucene.search.Explanationexplain(org.apache.lucene.index.LeafReaderContext context, int doc, float finalScore, List<org.apache.lucene.search.Explanation> featureExplanations)Similar to the score() function, except it returns an explanation of how the features were used to calculate the score.abstract Map<String,Object>fetchModelMap()Collection<Feature>getAllFeatures()List<Feature>getFeatures()org.apache.lucene.search.ExplanationgetNormalizerExplanation(org.apache.lucene.search.Explanation e, int idx)List<Normalizer>getNorms()inthashCode()voidnormalizeFeaturesInPlace(float[] modelFeatureValues)Goes through all the stored feature values, and calculates the normalized values for all the features that will be used for scoring.floatscore(float[] modelFeatureValuesNormalized)Given a list of normalized values for all features a scoring algorithm cares about, calculate and return a score.StringtoString()voidupdateModel(LTRScoringModel model)protected voidvalidate()Validate that settings make sense and throwsModelExceptionif they do not make sense.- 
Methods inherited from class org.apache.solr.ltr.model.AdapterModelinit
 - 
Methods inherited from class org.apache.solr.ltr.model.LTRScoringModelgetFeatureStoreName, getInstance, getName, getParams
 
- 
 
- 
- 
- 
Field Detail- 
modelprotected LTRScoringModel model 
 
- 
 - 
Method Detail- 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- LTRScoringModel
 
 - 
equalspublic boolean equals(Object obj) - Overrides:
- equalsin class- LTRScoringModel
 
 - 
validateprotected void validate() throws ModelExceptionDescription copied from class:LTRScoringModelValidate that settings make sense and throwsModelExceptionif they do not make sense.- Overrides:
- validatein class- LTRScoringModel
- Throws:
- ModelException
 
 - 
updateModelpublic void updateModel(LTRScoringModel model) 
 - 
fetchModelMappublic abstract Map<String,Object> fetchModelMap() throws ModelException - Throws:
- ModelException
 
 - 
getNormspublic List<Normalizer> getNorms() - Overrides:
- getNormsin class- LTRScoringModel
- Returns:
- the norms
 
 - 
getFeaturespublic List<Feature> getFeatures() - Overrides:
- getFeaturesin class- LTRScoringModel
- Returns:
- the features
 
 - 
getAllFeaturespublic Collection<Feature> getAllFeatures() - Overrides:
- getAllFeaturesin class- LTRScoringModel
 
 - 
scorepublic float score(float[] modelFeatureValuesNormalized) Description copied from class:LTRScoringModelGiven a list of normalized values for all features a scoring algorithm cares about, calculate and return a score.- Specified by:
- scorein class- LTRScoringModel
- Parameters:
- modelFeatureValuesNormalized- List of normalized feature values. Each feature is identified by its id, which is the index in the array
- Returns:
- The final score for a document
 
 - 
explainpublic org.apache.lucene.search.Explanation explain(org.apache.lucene.index.LeafReaderContext context, int doc, float finalScore, List<org.apache.lucene.search.Explanation> featureExplanations)Description copied from class:LTRScoringModelSimilar to the score() function, except it returns an explanation of how the features were used to calculate the score.- Specified by:
- explainin class- LTRScoringModel
- Parameters:
- context- Context the document is in
- doc- Document to explain
- finalScore- Original score
- featureExplanations- Explanations for each feature calculation
- Returns:
- Explanation for the scoring of a document
 
 - 
normalizeFeaturesInPlacepublic void normalizeFeaturesInPlace(float[] modelFeatureValues) Description copied from class:LTRScoringModelGoes through all the stored feature values, and calculates the normalized values for all the features that will be used for scoring.- Overrides:
- normalizeFeaturesInPlacein class- LTRScoringModel
 
 - 
getNormalizerExplanationpublic org.apache.lucene.search.Explanation getNormalizerExplanation(org.apache.lucene.search.Explanation e, int idx)- Overrides:
- getNormalizerExplanationin class- LTRScoringModel
 
 - 
toStringpublic String toString() - Overrides:
- toStringin class- LTRScoringModel
 
 
- 
 
-