use of org.apache.solr.ltr.feature.Feature in project lucene-solr by apache.
the class ManagedModelStore method fromLTRScoringModelMap.
@SuppressWarnings("unchecked")
public static LTRScoringModel fromLTRScoringModelMap(SolrResourceLoader solrResourceLoader, Map<String, Object> modelMap, ManagedFeatureStore managedFeatureStore) {
final FeatureStore featureStore = managedFeatureStore.getFeatureStore((String) modelMap.get(STORE_KEY));
final List<Feature> features = new ArrayList<>();
final List<Normalizer> norms = new ArrayList<>();
final List<Object> featureList = (List<Object>) modelMap.get(FEATURES_KEY);
if (featureList != null) {
for (final Object feature : featureList) {
final Map<String, Object> featureMap = (Map<String, Object>) feature;
features.add(lookupFeatureFromFeatureMap(featureMap, featureStore));
norms.add(createNormalizerFromFeatureMap(solrResourceLoader, featureMap));
}
}
return LTRScoringModel.getInstance(solrResourceLoader, // modelClassName
(String) modelMap.get(CLASS_KEY), // modelName
(String) modelMap.get(NAME_KEY), features, norms, featureStore.getName(), featureStore.getFeatures(), (Map<String, Object>) modelMap.get(PARAMS_KEY));
}
use of org.apache.solr.ltr.feature.Feature in project lucene-solr by apache.
the class TestLTRReRankingPipeline method makeFieldValueFeatures.
private static List<Feature> makeFieldValueFeatures(int[] featureIds, String field) {
final List<Feature> features = new ArrayList<>();
for (final int i : featureIds) {
final Map<String, Object> params = new HashMap<String, Object>();
params.put("field", field);
final Feature f = Feature.getInstance(solrResourceLoader, FieldValueFeature.class.getCanonicalName(), "f" + i, params);
f.setIndex(i);
features.add(f);
}
return features;
}
Aggregations