本文整理了Java中org.lumongo.client.command.Query.<init>
方法的一些代码示例,展示了Query.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.<init>
方法的具体详情如下:
包路径:org.lumongo.client.command.Query
类名称:Query
方法名:<init>
暂无
代码示例来源:origin: lumongo/lumongo
public void simpleQueryAsync() throws Exception {
Query query = new Query(MY_INDEX_NAME, "issn:1234-1234 AND title:special", 10);
ListenableFuture<QueryResult> resultFuture = lumongoWorkPool.queryAsync(query);
Futures.addCallback(resultFuture, new FutureCallback<QueryResult>() {
@Override
public void onSuccess(QueryResult explosion) {
}
@Override
public void onFailure(Throwable thrown) {
}
});
}
代码示例来源:origin: lumongo/lumongo
public void simpleQuery() throws Exception {
int numberOfResults = 10;
String[] indexes = new String[] { MY_INDEX_NAME, MY_INDEX_NAME2 };
String normalLuceneQuery = "issn:1234-1234 AND title:special";
Query query = new Query(indexes, normalLuceneQuery, numberOfResults);
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
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
public static void main(String[] args) throws Exception {
LogUtil.loadLogConfig();
lumongoWorkPool = new LumongoWorkPool(new LumongoPoolConfig().addMember("localhost"));
mapper = new Mapper<Article>(Article.class);
int maxSize = 2000;
ClientDocumentCache clientDocumentCache = new ClientDocumentCache(lumongoWorkPool, maxSize);
Query query = new Query("wikipedia", "title:a*", 10);
QueryResult queryResult = lumongoWorkPool.query(query);
BatchFetchResult batchFetchResult = clientDocumentCache.fetch(queryResult);
List<Article> articles = mapper.fromBatchFetchResult(batchFetchResult);
System.out.println(articles);
lumongoWorkPool.shutdown();
}
}
代码示例来源:origin: lumongo/lumongo
public void facetQuery() throws Exception {
// Can set number of documents to return to 0 unless you want the documents
// at the same time
String[] indexes = new String[] { MY_INDEX_NAME, MY_INDEX_NAME2 };
Query query = new Query(indexes, "title:special", 0);
int maxFacets = 30;
query.addCountRequest("issn", maxFacets);
QueryResult queryResult = lumongoWorkPool.query(query);
for (FacetCount fc : queryResult.getFacetCounts("issn")) {
System.out.println("Facet <" + fc.getFacet() + "> with count <" + fc.getCount() + ">");
}
}
代码示例来源:origin: lumongo/lumongo
public void drillDownQuery() throws Exception {
Query query = new Query(MY_INDEX_NAME, "title:special", 0);
query.addDrillDown("issn", "1111-1111");
QueryResult queryResult = lumongoWorkPool.query(query);
for (FacetCount fc : queryResult.getFacetCounts("issn")) {
System.out.println("Facet <" + fc.getFacet() + "> with count <" + fc.getCount() + ">");
}
}
代码示例来源:origin: lumongo/lumongo
@Test
public void test04Search() throws Exception {
LumongoWorkPool lumongoWorkPool = getLumongoWorkPool();
{
Query query = new Query("person", "firstName:Bob", 10);
QueryResult qr = lumongoWorkPool.query(query);
assertEquals(1, qr.getTotalHits());
}
{
Query query = new Query("person", "phoneNumbers.type:Mobile", 10);
QueryResult qr = lumongoWorkPool.query(query);
assertEquals(1, qr.getTotalHits());
}
{
Query query = new Query("person", "phoneNumbers.type:Home", 10);
QueryResult qr = lumongoWorkPool.query(query);
assertEquals(2, qr.getTotalHits());
}
}
代码示例来源:origin: lumongo/lumongo
"ultrasonic", "tyrosine", "tuberculosis", "triphosphate", "transplantable", "toxoplasmosis" };
Query q = new Query("medline", "cancer", 25);
代码示例来源:origin: lumongo/lumongo
public void pagingQuery() throws Exception {
int numberOfResults = 2;
String normalLuceneQuery = "issn:1234-1234 AND title:special";
String[] indexes = new String[] { MY_INDEX_NAME, MY_INDEX_NAME2 };
Query query = new Query(indexes, normalLuceneQuery, numberOfResults);
QueryResult firstResult = lumongoWorkPool.query(query);
query.setLastResult(firstResult);
QueryResult secondResult = lumongoWorkPool.query(query);
for (ScoredResult sr : secondResult.getResults()) {
System.out.println("Matching document <" + sr.getUniqueId() + "> with score <" + sr.getScore() + ">");
}
}
代码示例来源:origin: lumongo/lumongo
public void moreComplexQuery() throws Exception {
int numberOfResults = 10;
Query query = new Query(Arrays.asList(MY_INDEX_NAME, MY_INDEX_NAME2), "cancer cure", numberOfResults);
query.addQueryField("abstract");
query.addQueryField("title");
query.addFilterQuery("title:special");
query.addFilterQuery("issn:1234-1234");
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
Query query = new Query("medlineBoth", "title:" + term, 10);
query.setResultFetchType(fetchType);
Query query = new Query("medlineBoth", "title:cancer AND issn:*", 10);
query.setResultFetchType(fetchType);
query.addFieldSort("issn");
Query query = new Query("medlineBoth", "title:cancer AND issn:*", 10);
query.setResultFetchType(fetchType);
query.addCountRequest("issn", 4);
Query query = new Query("medlineBoth", "title:cancer AND issn:*", 10);
query.setResultFetchType(fetchType);
query.addCountRequest("issn", 4);
Query query = new Query("medlineBoth", "title:cancer AND issn:*", 10);
query.setResultFetchType(fetchType);
query.addCountRequest("journalCountry", 4);
Query query = new Query("medlineBoth", "title:asthma", 10);
query.setResultFetchType(fetchType);
query.addCountRequest("publicationDate", 15);
Query query = new Query("medlineBoth", "title:asthma", 10);
query.setResultFetchType(fetchType);
query.addCountRequest("publicationDate", 15);
Query query = new Query("medlineBoth", "title:cancer AND issn:*", 1000);
query.setResultFetchType(fetchType);
代码示例来源:origin: lumongo/lumongo
lumongoWorkPool = new LumongoWorkPool(lumongoPoolConfig);
Query q = new Query(indexes, query, amount);
代码示例来源:origin: lumongo/lumongo
public void queryWithBatchFetch() throws Exception {
int numberOfResults = 10;
String[] indexes = new String[] { MY_INDEX_NAME, MY_INDEX_NAME2 };
String normalLuceneQuery = "issn:1234-1234 AND title:special";
Query query = new Query(indexes, normalLuceneQuery, numberOfResults);
QueryResult queryResult = lumongoWorkPool.query(query);
List<ScoredResult> scoredResults = queryResult.getResults();
BatchFetch batchFetch = new BatchFetch();
batchFetch.addFetchDocumentsFromResults(scoredResults);
BatchFetchResult batchFetchResult = lumongoWorkPool.batchFetch(batchFetch);
@SuppressWarnings("unused") List<FetchResult> results = batchFetchResult.getFetchResults();
}
代码示例来源:origin: lumongo/lumongo
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addCountRequest("keyword", 30);
QueryResult qr = lumongoWorkPool.query(q);
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addCountRequest("keyword", 30);
QueryResult qr = lumongoWorkPool.query(q);
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addCountRequest("issn", 30);
QueryResult qr = lumongoWorkPool.query(q);
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addCountRequest("date", 30);
QueryResult qr = lumongoWorkPool.query(q);
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addDrillDown("date", "2014-10-04");
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addDrillDown("date", "2013-09-04");
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addDrillDown("date", "2013-08-04");
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addDrillDown("issn", "1234-1234");
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addDrillDown("issn", "1234-1234").addDrillDown("issn", "3333-1234");
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addDrillDown("issn", "1234-1234").addDrillDown("country", "France");
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10);
q.addDrillDown("issn", "1234-1234").addDrillDown("country", "France");
q.addCountRequest("issn");
代码示例来源:origin: lumongo/lumongo
LumongoWorkPool lumongoWorkPool = getLumongoWorkPool();
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addCountRequest("issn", 30);
QueryResult qr = lumongoWorkPool.query(q);
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addCountRequest("date", 30);
QueryResult qr = lumongoWorkPool.query(q);
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addDrillDown("date", "2014-10-04");
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addDrillDown("date", "2013-09-04");
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addDrillDown("date", "2013-08-04");
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addDrillDown("issn", "1234-1234");
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addDrillDown("issn", "1234-1234").addDrillDown("issn", "3333-1234");
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addDrillDown("issn", "1234-1234").addDrillDown("country", "France");
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10);
q.addDrillDown("issn", "1234-1234").addDrillDown("country", "France");
q.addCountRequest("issn");
代码示例来源:origin: lumongo/lumongo
String normalLuceneQuery = "issn:1234-1234 AND title:special";
Query q = new Query(MY_TEST_INDEX, normalLuceneQuery, numberOfResults);
QueryResult qr = lumongoWorkPool.query(q);
@SuppressWarnings("unused") long totalHits = qr.getTotalHits();
String normalLuceneQuery = "title:special";
Query q = new Query(MY_TEST_INDEX, normalLuceneQuery, numberOfResults);
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addCountRequest("issn", 30);
Query q = new Query(FACET_TEST_INDEX, "title:userguide", 10).addDrillDown("issn", "1234-1234");
代码示例来源:origin: lumongo/lumongo
lumongoWorkPool.store(s);
Query query = new Query(SingleNodeTest.MY_TEST_INDEX, "*:*", 10);
query.addFieldSort("date", Direction.ASCENDING);
QueryResult queryResult = lumongoWorkPool.query(query);
代码示例来源:origin: lumongo/lumongo
qr = lumongoWorkPool.query(new Query(MY_TEST_INDEX, "an:3", 10));
assertEquals("Total hits is not 1", 1, qr.getTotalHits());
qr = lumongoWorkPool.query(new Query(MY_TEST_INDEX, "an:[1 TO 3]", 10));
assertEquals("Total hits is not 3", 3, qr.getTotalHits());
qr = lumongoWorkPool.query(new Query(MY_TEST_INDEX, "an:{1 TO 3}", 10));
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());
qr = lumongoWorkPool.query(new Query(MY_TEST_INDEX, "title:distributed", 300));
assertEquals("Total hits is not " + DOCUMENTS_LOADED, DOCUMENTS_LOADED, qr.getTotalHits());
qr = lumongoWorkPool.query(new Query(MY_TEST_INDEX, "title:distributed", 100));
assertEquals("Total hits is not " + DOCUMENTS_LOADED, DOCUMENTS_LOADED, qr.getTotalHits());
qr = lumongoWorkPool.query(new Query(MY_TEST_INDEX, "distributed", 20));
assertEquals("Total hits is not " + DOCUMENTS_LOADED, DOCUMENTS_LOADED, qr.getTotalHits());
qr = lumongoWorkPool.query(new Query(MY_TEST_INDEX, "issn:1234-1234", 20));
assertEquals("Total hits is not " + DOCUMENTS_LOADED, DOCUMENTS_LOADED, qr.getTotalHits());
qr = lumongoWorkPool.query(new Query(MY_TEST_INDEX, "title:cluster", 10));
代码示例来源:origin: lumongo/lumongo
assertTrue("Document is missing raw document before delete", fr.hasResultDocument());
qr = lumongoWorkPool.query(new Query(MY_TEST_INDEX, "uid" + ":" + uniqueIdToDelete, 10));
assertEquals("Total hits is not 1 before delete", 1, qr.getTotalHits());
assertTrue("Document has raw document after delete", !fr.hasResultDocument());
qr = lumongoWorkPool.query(new Query(MY_TEST_INDEX, "uid" + ":" + uniqueIdToDelete, 10));
assertEquals("Total hits is not 0 after delete", 0, qr.getTotalHits());
内容来源于网络,如有侵权,请联系作者删除!