SOLR-11351: make LTRScoringModel model more extensible

This commit is contained in:
Christine Poerschke 2017-09-11 12:35:27 -07:00
parent 1544839309
commit 0c831b9970
2 changed files with 5 additions and 1 deletions

View File

@ -203,6 +203,8 @@ Other Changes
* SOLR-11132: Refactor common getSortField logic in various FieldTypes (Jason Gerlowski, hossman)
* SOLR-11351: Make LTRScoringModel model more extensible. (Christine Poerschke)
================== 7.0.0 ==================
Versions of Major Components

View File

@ -80,7 +80,7 @@ public abstract class LTRScoringModel {
protected final List<Feature> features;
private final List<Feature> allFeatures;
private final Map<String,Object> params;
private final List<Normalizer> norms;
protected final List<Normalizer> norms;
public static LTRScoringModel getInstance(SolrResourceLoader solrResourceLoader,
String className, String name, List<Feature> features,
@ -123,6 +123,8 @@ public abstract class LTRScoringModel {
* {@link ModelException} if they do not make sense.
*/
protected void validate() throws ModelException {
final List<Feature> features = getFeatures();
final List<Normalizer> norms = getNorms();
if (features.isEmpty()) {
throw new ModelException("no features declared for model "+name);
}