Search in sources :

Example 1 with LTRQParserPlugin

use of org.apache.solr.ltr.search.LTRQParserPlugin in project lucene-solr by apache.

the class TestModelManager method test.

@Test
public void test() throws Exception {
    final SolrResourceLoader loader = new SolrResourceLoader(tmpSolrHome.toPath());
    final RestManager.Registry registry = loader.getManagedResourceRegistry();
    assertNotNull("Expected a non-null RestManager.Registry from the SolrResourceLoader!", registry);
    final String resourceId = "/schema/fstore1";
    registry.registerManagedResource(resourceId, ManagedFeatureStore.class, new LTRQParserPlugin());
    final String resourceId2 = "/schema/mstore1";
    registry.registerManagedResource(resourceId2, ManagedModelStore.class, new LTRQParserPlugin());
    final NamedList<String> initArgs = new NamedList<>();
    final RestManager restManager = new RestManager();
    restManager.init(loader, initArgs, new ManagedResourceStorage.InMemoryStorageIO());
    final ManagedResource res = restManager.getManagedResource(resourceId);
    assertTrue(res instanceof ManagedFeatureStore);
    assertEquals(res.getResourceId(), resourceId);
}
Also used : SolrResourceLoader(org.apache.solr.core.SolrResourceLoader) NamedList(org.apache.solr.common.util.NamedList) LTRQParserPlugin(org.apache.solr.ltr.search.LTRQParserPlugin) ManagedResourceStorage(org.apache.solr.rest.ManagedResourceStorage) RestManager(org.apache.solr.rest.RestManager) ManagedResource(org.apache.solr.rest.ManagedResource) Test(org.junit.Test)

Aggregations

NamedList (org.apache.solr.common.util.NamedList)1 SolrResourceLoader (org.apache.solr.core.SolrResourceLoader)1 LTRQParserPlugin (org.apache.solr.ltr.search.LTRQParserPlugin)1 ManagedResource (org.apache.solr.rest.ManagedResource)1 ManagedResourceStorage (org.apache.solr.rest.ManagedResourceStorage)1 RestManager (org.apache.solr.rest.RestManager)1 Test (org.junit.Test)1