当前位置: 首页>>代码示例>>Java>>正文


Java ResultSet.getNumberFound方法代码示例

本文整理汇总了Java中org.alfresco.service.cmr.search.ResultSet.getNumberFound方法的典型用法代码示例。如果您正苦于以下问题:Java ResultSet.getNumberFound方法的具体用法?Java ResultSet.getNumberFound怎么用?Java ResultSet.getNumberFound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.alfresco.service.cmr.search.ResultSet的用法示例。


在下文中一共展示了ResultSet.getNumberFound方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DetachedResultSet

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
/**
 * Detached result set based on that provided
 * @param resultSet ResultSet
 */
public DetachedResultSet(ResultSet resultSet)
{
    super();
    rsmd = resultSet.getResultSetMetaData();
    rows = new ArrayList<ResultSetRow>(resultSet.length());
    for (ResultSetRow row : resultSet)
    {
        rows.add(new DetachedResultSetRow(this, row));
    }
    numberFound = resultSet.getNumberFound();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:16,代码来源:DetachedResultSet.java

示例2: getNumberFound

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
@Override
public long getNumberFound()
{
    for (ResultSet resultSet : wrapped.values())
    {
        return resultSet.getNumberFound();
    }
    throw new IllegalStateException();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:CMISResultSet.java

示例3: setTotal

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
/**
 * Sets the total number found.
 * @param results
 * @return An integer total
 */
public Integer setTotal(ResultSet results)
{
    Long totalItems = results.getNumberFound();
    Integer total = totalItems.intValue();
    return total;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:12,代码来源:ResultMapper.java

示例4: testToCollectionWithPagingInfo

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
@Test
public void testToCollectionWithPagingInfo() throws Exception
{
    ResultSet results = mockResultset(Arrays.asList(514l), Arrays.asList(566l, VERSIONED_ID));
    SearchRequestContext searchRequest = SearchRequestContext.from(SearchQuery.EMPTY);
    CollectionWithPagingInfo<Node> collectionWithPage =  mapper.toCollectionWithPagingInfo(EMPTY_PARAMS, searchRequest, SearchQuery.EMPTY, results);
    assertNotNull(collectionWithPage);
    Long found = results.getNumberFound();
    assertEquals(found.intValue(), collectionWithPage.getTotalItems().intValue());
    Node firstNode = collectionWithPage.getCollection().stream().findFirst().get();
    assertNotNull(firstNode.getSearch().getScore());
    assertEquals(StoreMapper.LIVE_NODES, firstNode.getLocation());
    collectionWithPage.getCollection().stream().forEach(aNode -> {
        List<HighlightEntry> high = aNode.getSearch().getHighlight();
        if (high != null)
        {
            assertEquals(2, high.size());
            HighlightEntry first = high.get(0);
            assertNotNull(first.getField());
            assertNotNull(first.getSnippets());
        }
    });
    //1 deleted node in the test data
    assertEquals(1l, collectionWithPage.getCollection().stream().filter(node -> StoreMapper.DELETED.equals(node.getLocation())).count());

    //1 version nodes in the test data (and 1 is not shown because it is in the archive store)
    assertEquals(1l, collectionWithPage.getCollection().stream().filter(node -> StoreMapper.VERSIONS.equals(node.getLocation())).count());
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:29,代码来源:ResultMapperTests.java

示例5: findBlogPosts

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
@Override
public PagingResults<BlogPostInfo> findBlogPosts(
      final NodeRef blogContainerNode, final RangedDateProperty dateRange, 
      final String tag, final PagingRequest pagingReq)
{
    StringBuilder luceneQuery = new StringBuilder();
    luceneQuery.append("+TYPE:\"").append(ContentModel.TYPE_CONTENT).append("\" ")
               .append("+PARENT:\"").append(blogContainerNode.toString()).append("\" ");
    if (tag != null && !tag.trim().isEmpty())
    {
        luceneQuery.append("+PATH:\"/cm:taggable/cm:").append(ISO9075.encode(tag)).append("/member\"");
    }
    if (dateRange != null)
    {
        luceneQuery.append(createDateRangeQuery(dateRange.getFromDate(), dateRange.getToDate(), dateRange.getDateProperty()));
    }

    SearchParameters sp = new SearchParameters();
    sp.addStore(blogContainerNode.getStoreRef());
    sp.setLanguage(SearchService.LANGUAGE_LUCENE);
    sp.setQuery(luceneQuery.toString());
    sp.addSort(ContentModel.PROP_PUBLISHED.toString(), false);

    sp.setMaxItems(pagingReq.getMaxItems() * MIN_NUMBER_OF_PAGES_FOR_THE_USER_TO_LOOP_THROUGH); 
    sp.setSkipCount(pagingReq.getSkipCount());
    ResultSet luceneResults = null;
    PagingResults<BlogPostInfo> results = null;
    try
    {
        luceneResults = searchService.query(sp);
        final ResultSet finalLuceneResults = luceneResults;
        
        final List<NodeRef> nodeRefs = finalLuceneResults.getNodeRefs().subList(0, min(pagingReq.getMaxItems(), finalLuceneResults.length()));
        
        results = new PagingResults<BlogPostInfo>()
        {
            
            @Override
            public List<BlogPostInfo> getPage()
            {
                List<BlogPostInfo> blogPostInfos = new ArrayList<BlogPostInfo>(nodeRefs.size());
                for (NodeRef nodeRef : nodeRefs)
                {
                    String postName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); 
                    blogPostInfos.add(new BlogPostInfoImpl(nodeRef, blogContainerNode, postName));
                }
                return blogPostInfos;
            }
            
            @Override
            public String getQueryExecutionId()
            {
                return null;
            }
            
            @Override
            public Pair<Integer, Integer> getTotalResultCount()
            { 
                long totalResultCount = finalLuceneResults.getNumberFound();
                /*if (finalLuceneResults.hasMore()){
                    totalResultCount++;
                }*/ 
                return new Pair<Integer, Integer>((int)totalResultCount, (int)totalResultCount);
            }
            
            @Override
            public boolean hasMoreItems()
            {
                return finalLuceneResults.length() > pagingReq.getMaxItems();
            }
        };
    }
    finally
    {
        if (luceneResults != null) luceneResults.close();
    }
    
    
    return results;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:81,代码来源:BlogServiceImpl.java

示例6: asPagingResults

import org.alfresco.service.cmr.search.ResultSet; //导入方法依赖的package包/类
private PagingResults<Reference> asPagingResults(ActualEnvironment environment, PagingRequest pagingRequest,
            ResultSet result, Reference parentReference) throws ActualEnvironmentException
{
    final List<Reference> page = new LinkedList<Reference>();

    for (ResultSetRow row : result)
    {
        page.add(NodeProtocol.newReference(row.getNodeRef(),
                                           parentReference));
    }

    final boolean hasMore = result.hasMore();
    final int totalFirst = (int) result.getNumberFound();
    int start;
    try
    {
        start = result.getStart();
    }
    catch (UnsupportedOperationException e)
    {
        if (logger.isDebugEnabled())
        {
            logger.debug("Unsupported ResultSet.getStart() when trying to create query paging result");
        }
        if (pagingRequest != null)
        {
            start = pagingRequest.getSkipCount();
        }
        else
        {
            start = 0;
        }
    }
    final int totlaSecond = !hasMore ? (int) result.getNumberFound() : (int) (start + result.getNumberFound() + 1);
    final Pair<Integer, Integer> total = new Pair<Integer, Integer>(totalFirst,
                                                                    totlaSecond);
    return new PagingResults<Reference>()
    {

        @Override
        public List<Reference> getPage()
        {
            return page;
        }

        @Override
        public boolean hasMoreItems()
        {
            return hasMore;
        }

        @Override
        public Pair<Integer, Integer> getTotalResultCount()
        {

            return total;
        }

        @Override
        public String getQueryExecutionId()
        {
            return null;
        }

    };
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:67,代码来源:VirtualQueryImpl.java


注:本文中的org.alfresco.service.cmr.search.ResultSet.getNumberFound方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。