Package org.apache.solr.ltr.model
Class DefaultWrapperModel
- java.lang.Object
-
- org.apache.solr.ltr.model.LTRScoringModel
-
- org.apache.solr.ltr.model.AdapterModel
-
- org.apache.solr.ltr.model.WrapperModel
-
- org.apache.solr.ltr.model.DefaultWrapperModel
-
- All Implemented Interfaces:
org.apache.lucene.util.Accountable
public class DefaultWrapperModel extends WrapperModel
A scoring model that fetches the wrapped model fromSolrResourceLoader
.This model uses
SolrResourceLoader.openResource(String)
for fetching the wrapped model. If you give a relative path forparams/resource
, this model will try to load the wrapped model from the instance directory (i.e. ${solr.solr.home}). Otherwise, seek through classpaths.Example configuration:
{ "class": "org.apache.solr.ltr.model.DefaultWrapperModel", "name": "myWrapperModelName", "params": { "resource": "models/myModel.json" } }
- See Also:
SolrResourceLoader.openResource(String)
-
-
Field Summary
-
Fields inherited from class org.apache.solr.ltr.model.WrapperModel
model
-
Fields inherited from class org.apache.solr.ltr.model.AdapterModel
solrResourceLoader
-
Fields inherited from class org.apache.solr.ltr.model.LTRScoringModel
features, name, norms
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>
fetchModelMap()
protected InputStream
openInputStream()
protected Map<String,Object>
parseInputStream(InputStream in)
void
setResource(String resource)
String
toString()
protected void
validate()
Validate that settings make sense and throwsModelException
if they do not make sense.-
Methods inherited from class org.apache.solr.ltr.model.WrapperModel
equals, explain, getAllFeatures, getFeatures, getNormalizerExplanation, getNorms, hashCode, normalizeFeaturesInPlace, ramBytesUsed, score, updateModel
-
Methods inherited from class org.apache.solr.ltr.model.AdapterModel
init
-
Methods inherited from class org.apache.solr.ltr.model.LTRScoringModel
getFeatureStoreName, getInstance, getName, getParams
-
-
-
-
Method Detail
-
setResource
public void setResource(String resource)
-
validate
protected void validate() throws ModelException
Description copied from class:LTRScoringModel
Validate that settings make sense and throwsModelException
if they do not make sense.- Overrides:
validate
in classWrapperModel
- Throws:
ModelException
-
fetchModelMap
public Map<String,Object> fetchModelMap() throws ModelException
- Specified by:
fetchModelMap
in classWrapperModel
- Throws:
ModelException
-
openInputStream
protected InputStream openInputStream() throws IOException
- Throws:
IOException
-
parseInputStream
protected Map<String,Object> parseInputStream(InputStream in) throws IOException
- Throws:
IOException
-
toString
public String toString()
- Overrides:
toString
in classWrapperModel
-
-