Search in sources :

Example 1 with ValueFeature

use of org.apache.solr.ltr.feature.ValueFeature in project lucene-solr by apache.

the class TestManagedFeatureStore method testFeatureStoreGet.

@Test
public void testFeatureStoreGet() throws FeatureException {
    final FeatureStore fs = fstore.getFeatureStore("fstore-testFeature2");
    for (int i = 0; i < 5; i++) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("value", i);
        final String name = "c" + i;
        fstore.addFeature(createMap(name, ValueFeature.class.getCanonicalName(), params), "fstore-testFeature2");
    }
    for (int i = 0; i < 5; i++) {
        final Feature f = fs.get("c" + i);
        assertEquals("c" + i, f.getName());
        assertTrue(f instanceof ValueFeature);
        final ValueFeature vf = (ValueFeature) f;
        assertEquals(i, vf.getValue());
    }
}
Also used : HashMap(java.util.HashMap) ValueFeature(org.apache.solr.ltr.feature.ValueFeature) ValueFeature(org.apache.solr.ltr.feature.ValueFeature) Feature(org.apache.solr.ltr.feature.Feature) OriginalScoreFeature(org.apache.solr.ltr.feature.OriginalScoreFeature) FeatureStore(org.apache.solr.ltr.store.FeatureStore) ManagedFeatureStore(org.apache.solr.ltr.store.rest.ManagedFeatureStore) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 Feature (org.apache.solr.ltr.feature.Feature)1 OriginalScoreFeature (org.apache.solr.ltr.feature.OriginalScoreFeature)1 ValueFeature (org.apache.solr.ltr.feature.ValueFeature)1 FeatureStore (org.apache.solr.ltr.store.FeatureStore)1 ManagedFeatureStore (org.apache.solr.ltr.store.rest.ManagedFeatureStore)1 Test (org.junit.Test)1