org.infinispan.query.dsl.Query.getResultSize()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中org.infinispan.query.dsl.Query.getResultSize方法的一些代码示例,展示了Query.getResultSize的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getResultSize方法的具体详情如下:
包路径:org.infinispan.query.dsl.Query
类名称:Query
方法名:getResultSize

Query.getResultSize介绍

[英]Gets the total number of results matching the query, ignoring pagination (firstResult, maxResult).
[中]获取与查询匹配的结果总数,忽略分页(firstResult,maxResult)。

代码示例

代码示例来源:origin: org.infinispan/infinispan-query

@Override
public int getResultSize() {
 return createQuery().getResultSize();
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

@Override
public int getResultSize() {
 return createQuery().getResultSize();
}

代码示例来源:origin: kiegroup/appformer

@Override
public long findHitsByQuery(List<String> indices,
              Query query) {
  return this.findByQueryRaw(indices,
                query,
                null)
      .stream()
      .mapToInt(q -> this.checkHitsQuery(() -> q.getResultSize()))
      .sum();
}

代码示例来源:origin: org.uberfire/uberfire-metadata-backend-infinispan

@Override
public long findHitsByQuery(List<String> indices,
              Query query) {
  return this.findByQueryRaw(indices,
                query,
                null)
      .stream()
      .mapToInt(q -> this.checkHitsQuery(() -> q.getResultSize()))
      .sum();
}

代码示例来源:origin: org.infinispan.server/infinispan-server-testsuite

private void assertIndexSize(RemoteCache<Integer, Transaction> remoteCache) {
    Query query = Search.getQueryFactory(remoteCache).create("From Transaction");
    assertEquals("Entries should be indexed", 100, query.getResultSize());
  }
}

代码示例来源:origin: org.infinispan/infinispan-query

private void executeQueries() {
 String q = getQuery();
 caches().forEach(c -> {
   Query allNodesQuery = Search.getQueryFactory(c).create(q, getIndexedQueryMode());
   assertAllNodesQueryResults(allNodesQuery.getResultSize());
 });
 Query singleNodeQuery = Search.getQueryFactory(cache(0)).create(q);
 assertSingleNodeQueryResults(singleNodeQuery.list().size());
}

代码示例来源:origin: org.infinispan/infinispan-query

public void testUnorderedPagination5() {
 QueryFactory qf = getQueryFactory();
 Query q = qf.from(getModelFactory().getUserImplClass())
    .startOffset(20)
    .build();
 List<User> list = q.list();
 assertEquals(3, q.getResultSize());
 assertEquals(0, list.size());
}

代码示例来源:origin: org.infinispan/infinispan-query

public void testUnorderedPagination7() {
 QueryFactory qf = getQueryFactory();
 Query q = qf.from(getModelFactory().getUserImplClass())
    .startOffset(1).maxResults(10)
    .build();
 List<User> list = q.list();
 assertEquals(3, q.getResultSize());
 assertEquals(2, list.size());
}

代码示例来源:origin: org.infinispan/infinispan-query

public void testUnorderedPagination4() {
 QueryFactory qf = getQueryFactory();
 Query q = qf.from(getModelFactory().getUserImplClass())
    .maxResults(5)
    .build();
 List<User> list = q.list();
 assertEquals(3, q.getResultSize());
 assertEquals(3, list.size());
}

代码示例来源:origin: org.infinispan/infinispan-query

public void testOrderedPagination5() {
 QueryFactory qf = getQueryFactory();
 Query q = qf.from(getModelFactory().getUserImplClass())
    .orderBy("id", SortOrder.ASC)
    .startOffset(20)
    .build();
 List<User> list = q.list();
 assertEquals(3, q.getResultSize());
 assertEquals(0, list.size());
}

代码示例来源:origin: org.infinispan/infinispan-query

public void testUnorderedPagination6() {
 QueryFactory qf = getQueryFactory();
 Query q = qf.from(getModelFactory().getUserImplClass())
    .startOffset(20).maxResults(10)
    .build();
 List<User> list = q.list();
 assertEquals(3, q.getResultSize());
 assertEquals(0, list.size());
}

代码示例来源:origin: org.infinispan/infinispan-query

public void testOrderedPagination4() {
 QueryFactory qf = getQueryFactory();
 Query q = qf.from(getModelFactory().getUserImplClass())
    .orderBy("id", SortOrder.ASC)
    .maxResults(5)
    .build();
 List<User> list = q.list();
 assertEquals(3, q.getResultSize());
 assertEquals(3, list.size());
}

代码示例来源:origin: org.infinispan/infinispan-query

public void testUnorderedPagination8() {
 QueryFactory qf = getQueryFactory();
 Query q = qf.from(getModelFactory().getUserImplClass())
    .startOffset(0).maxResults(2)
    .build();
 List<User> list = q.list();
 assertEquals(3, q.getResultSize());
 assertEquals(2, list.size());
}

代码示例来源:origin: org.infinispan/infinispan-query

public void testOrderedPagination6() {
 QueryFactory qf = getQueryFactory();
 Query q = qf.from(getModelFactory().getUserImplClass())
    .orderBy("id", SortOrder.ASC)
    .startOffset(20).maxResults(10)
    .build();
 List<User> list = q.list();
 assertEquals(3, q.getResultSize());
 assertEquals(0, list.size());
}

代码示例来源:origin: org.infinispan/infinispan-query

public void testOrderedPagination7() {
 QueryFactory qf = getQueryFactory();
 Query q = qf.from(getModelFactory().getUserImplClass())
    .orderBy("id", SortOrder.ASC)
    .startOffset(1).maxResults(10)
    .build();
 List<User> list = q.list();
 assertEquals(3, q.getResultSize());
 assertEquals(2, list.size());
}

代码示例来源:origin: org.infinispan/infinispan-query

public void testOrderedPagination8() {
 QueryFactory qf = getQueryFactory();
 Query q = qf.from(getModelFactory().getUserImplClass())
    .orderBy("id", SortOrder.ASC)
    .startOffset(0).maxResults(2)
    .build();
 List<User> list = q.list();
 assertEquals(3, q.getResultSize());
 assertEquals(2, list.size());
}

代码示例来源:origin: org.infinispan/infinispan-query

public void testSampleDomainQuery16() {
 QueryFactory qf = getQueryFactory();
 // third batch of 10 transactions for a given account
 Query q = qf.from(getModelFactory().getTransactionImplClass())
    .startOffset(20).maxResults(10)
    .orderBy("id", SortOrder.ASC)
    .having("accountId").eq(2).and().having("description").like("Expensive%")
    .build();
 List<Transaction> list = q.list();
 assertEquals(50, q.getResultSize());
 assertEquals(10, list.size());
 for (int i = 0; i < 10; i++) {
   assertEquals("Expensive shoes " + (20 + i), list.get(i).getDescription());
 }
}

相关文章