Search in sources :

Example 1 with LinearModel

use of org.apache.solr.ltr.model.LinearModel in project lucene-solr by apache.

the class TestLTRQParserExplain method testRerankedExplain.

@Test
public void testRerankedExplain() throws Exception {
    loadModel("linear2", LinearModel.class.getCanonicalName(), new String[] { "constant1", "constant2", "pop" }, "{\"weights\":{\"pop\":1.0,\"constant1\":1.5,\"constant2\":3.5}}");
    final SolrQuery query = new SolrQuery();
    query.setQuery("title:bloomberg");
    query.setParam("debugQuery", "on");
    query.add("rows", "2");
    query.add("rq", "{!ltr reRankDocs=2 model=linear2}");
    query.add("fl", "*,score");
    assertJQ("/query" + query.toQueryString(), "/debug/explain/9=='\n13.5 = LinearModel(name=linear2,featureWeights=[constant1=1.5,constant2=3.5,pop=1.0]) model applied to features, sum of:\n  1.5 = prod of:\n    1.5 = weight on feature\n    1.0 = ValueFeature [name=constant1, params={value=1}]\n  7.0 = prod of:\n    3.5 = weight on feature\n    2.0 = ValueFeature [name=constant2, params={value=2}]\n  5.0 = prod of:\n    1.0 = weight on feature\n    5.0 = FieldValueFeature [name=pop, params={field=popularity}]\n'");
}
Also used : LinearModel(org.apache.solr.ltr.model.LinearModel) SolrQuery(org.apache.solr.client.solrj.SolrQuery) Test(org.junit.Test)

Aggregations

SolrQuery (org.apache.solr.client.solrj.SolrQuery)1 LinearModel (org.apache.solr.ltr.model.LinearModel)1 Test (org.junit.Test)1