本文整理汇总了Java中org.apache.solr.search.DocIterator.score方法的典型用法代码示例。如果您正苦于以下问题:Java DocIterator.score方法的具体用法?Java DocIterator.score怎么用?Java DocIterator.score使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.solr.search.DocIterator
的用法示例。
在下文中一共展示了DocIterator.score方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSimpleXJoinResultsFactory
import org.apache.solr.search.DocIterator; //导入方法依赖的package包/类
@Test
@SuppressWarnings("rawtypes")
public void testSimpleXJoinResultsFactory() {
ModifiableSolrParams params = new ModifiableSolrParams();
params.add("fl", "*, score");
params.add("xjoin", "false");
params.add("xjoin5", "true");
params.add("xjoin5.fl", "*");
// score boosts using value source parser
params.add("defType", "edismax");
params.add("bf", "xjoin5(value)");
NamedList results = test(params, "xjoin5");
ResultContext response = (ResultContext)results.get("response");
DocList docs = response.getDocList();
assertEquals(2, docs.size());
DocIterator it = docs.iterator();
assertTrue(it.hasNext());
assertEquals(0, it.nextDoc());
double score0 = it.score();
assertTrue(it.hasNext());
assertEquals(2, it.nextDoc());
double score2 = it.score();
assertFalse(it.hasNext());
// bf score boost for testid=0 only
assertTrue(score0 > score2);
List externalList = (List)((NamedList)results.get("xjoin5")).get("external");
NamedList hit0 = (NamedList)externalList.get(0);
assertEquals("0", hit0.get("joinId"));
NamedList doc0 = (NamedList)hit0.get("doc");
assertEquals("red", doc0.get("colour"));
assertEquals(10.5, doc0.get("value"));
}
示例2: testSimpleXJoinResultsFactory
import org.apache.solr.search.DocIterator; //导入方法依赖的package包/类
@Test
@SuppressWarnings("rawtypes")
public void testSimpleXJoinResultsFactory() {
ModifiableSolrParams params = new ModifiableSolrParams();
params.add("fl", "*, score");
params.add("xjoin", "false");
params.add("xjoin5", "true");
params.add("xjoin5.fl", "*");
// score boosts using value source parser
params.add("defType", "edismax");
params.add("bf", "xjoin5(value)");
NamedList results = test(params, "xjoin5");
ResultContext response = (ResultContext)results.get("response");
DocList docs = response.docs;
assertEquals(2, docs.size());
DocIterator it = docs.iterator();
assertTrue(it.hasNext());
assertEquals(0, it.nextDoc());
double score0 = it.score();
assertTrue(it.hasNext());
assertEquals(2, it.nextDoc());
double score2 = it.score();
assertFalse(it.hasNext());
// bf score boost for testid=0 only
assertTrue(score0 > score2);
List externalList = (List)((NamedList)results.get("xjoin5")).get("external");
NamedList hit0 = (NamedList)externalList.get(0);
assertEquals("0", hit0.get("joinId"));
NamedList doc0 = (NamedList)hit0.get("doc");
assertEquals("red", doc0.get("colour"));
assertEquals(10.5, doc0.get("value"));
}