本文整理汇总了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();
}
示例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();
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
};
}