本文整理了Java中org.lumongo.client.command.Query.addFieldSort
方法的一些代码示例,展示了Query.addFieldSort
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.addFieldSort
方法的具体详情如下:
包路径:org.lumongo.client.command.Query
类名称:Query
方法名:addFieldSort
暂无
代码示例来源:origin: lumongo/lumongo
public void simpleQueryWithSort() throws Exception {
int numberOfResults = 10;
String normalLuceneQuery = "title:special";
Query query = new Query(MY_INDEX_NAME, normalLuceneQuery, numberOfResults);
query.addFieldSort("issn", Direction.ASCENDING);
QueryResult queryResult = lumongoWorkPool.query(query);
long totalHits = queryResult.getTotalHits();
System.out.println("Found <" + totalHits + "> hits");
for (ScoredResult sr : queryResult.getResults()) {
System.out.println("Matching document <" + sr.getUniqueId() + "> with score <" + sr.getScore() + ">");
}
}
代码示例来源:origin: lumongo/lumongo
q.addFieldSort(sortDesc, Direction.DESCENDING);
代码示例来源:origin: lumongo/lumongo
query.addFieldSort("issn");
QueryResult queryResult = lumongoWorkPool.query(query);
代码示例来源:origin: lumongo/lumongo
query.addFieldSort("date", Direction.ASCENDING);
QueryResult queryResult = lumongoWorkPool.query(query);
代码示例来源:origin: lumongo/lumongo
assertEquals("Total hits is not 1", 1, qr.getTotalHits());
qr = lumongoWorkPool.query(new Query(MY_TEST_INDEX, "an:[1 TO 5]", 10).addFieldSort("an"));
assertEquals("Unique id does not match expected", "someUniqueId-1", qr.getResults().get(0).getUniqueId());
qr = lumongoWorkPool.query(new Query(MY_TEST_INDEX, "an:[1 TO 4]", 10).addFieldSort("an", Lumongo.FieldSort.Direction.DESCENDING));
System.out.println(qr.getResults().get(0).getSortValues());
assertEquals("Unique id does not match expected", "someUniqueId-4", qr.getResults().get(0).getUniqueId());
Query sortQuery = new Query(MY_TEST_INDEX, "an:[0 TO 5]", 2).addFieldSort("an").setResultFetchType(Lumongo.FetchType.FULL);
QueryResult first = lumongoWorkPool.query(sortQuery);
assertEquals("Result size is not 2", 2, first.getResults().size());
Query sortQuery = new Query(MY_TEST_INDEX, "an:[0 TO 5]", 2).addFieldSort("an").setResultFetchType(Lumongo.FetchType.FULL);
QueryResult first = lumongoWorkPool.query(sortQuery);
assertEquals("Result size is not 2", 2, first.getResults().size());
Query sortQuery = new Query(MY_TEST_INDEX, "an:[0 TO 5]", 2).addFieldSort("an").setResultFetchType(Lumongo.FetchType.FULL);
QueryResult first = lumongoWorkPool.query(sortQuery);
assertEquals("Result size is not 2", 2, first.getResults().size());
内容来源于网络,如有侵权,请联系作者删除!