本文整理汇总了Java中org.alfresco.service.cmr.search.SearchParameters.setSkipCount方法的典型用法代码示例。如果您正苦于以下问题:Java SearchParameters.setSkipCount方法的具体用法?Java SearchParameters.setSkipCount怎么用?Java SearchParameters.setSkipCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.search.SearchParameters
的用法示例。
在下文中一共展示了SearchParameters.setSkipCount方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: query
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
/**
* Execute the query
*
* Removes any duplicates that may be present (ID search can cause duplicates -
* it is better to remove them here)
*
* @param store StoreRef to search against - null for default configured store
* @param search Lucene search to execute
* @param sort Columns to sort by
* @param language Search language to use e.g. SearchService.LANGUAGE_LUCENE
* @param maxResults Maximum results to return if > 0
* @param skipResults Results to skip in the result set
*
* @return Array of Node objects
*/
protected Object[] query(String store, String search, SortColumn[] sort, String language, int maxResults, int skipResults)
{
SearchParameters sp = new SearchParameters();
sp.addStore(store != null ? new StoreRef(store) : this.storeRef);
sp.setLanguage(language != null ? language : SearchService.LANGUAGE_LUCENE);
sp.setQuery(search);
if (maxResults > 0)
{
sp.setLimit(maxResults);
sp.setLimitBy(LimitBy.FINAL_SIZE);
}
if (skipResults > 0)
{
sp.setSkipCount(skipResults);
}
if (sort != null)
{
for (SortColumn sd : sort)
{
sp.addSort(sd.column, sd.asc);
}
}
return query(sp, true);
}
示例2: prepareSearchParameters
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
@Override
protected SearchParameters prepareSearchParameters(final WebScriptRequest req, final NodeRef archiveContextNode, final int pageSize,
final int startIndex)
{
final SearchParameters sp = new SearchParameters();
sp.addStore(archiveContextNode.getStoreRef());
sp.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
sp.setQueryConsistency(QueryConsistency.TRANSACTIONAL_IF_POSSIBLE);
final StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("PARENT:\"").append(archiveContextNode).append("\"");
sp.setQuery(queryBuilder.toString());
sp.setSkipCount(startIndex);
sp.setLimit(pageSize);
sp.setMaxItems(pageSize);
return sp;
}
示例3: createSearchParameters
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
private SearchParameters createSearchParameters(boolean files, boolean folders, PagingRequest pagingRequest)
throws VirtualizationException
{
SearchParameters searchParameters = new SearchParameters();
if (store != null)
{
searchParameters.addStore(new StoreRef(store));
}
else
{
searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
}
searchParameters.setLanguage(language);
searchParameters.setQuery(filter(language,
query,
files,
folders));
searchParameters.setQueryConsistency(QueryConsistency.TRANSACTIONAL_IF_POSSIBLE);
if (pagingRequest != null)
{
searchParameters.setSkipCount(pagingRequest.getSkipCount());
searchParameters.setMaxItems(pagingRequest.getMaxItems());
}
return searchParameters;
}
示例4: applyDecorations
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
@Override
protected SearchParameters applyDecorations(ActualEnvironment environment, SearchParameters searchParameters,
VirtualQuery query)
{
SearchParameters searchParametersCopy = searchParameters.copy();
if (pagingRequest != null)
{
searchParametersCopy.setSkipCount(pagingRequest.getSkipCount());
searchParametersCopy.setMaxItems(pagingRequest.getMaxItems());
}
return searchParametersCopy;
}
示例5: fromPaging
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
/**
* SearchParameters from the Paging object
* @param sp SearchParameters
* @param paging Paging
*/
public void fromPaging(SearchParameters sp, Paging paging)
{
if (paging != null)
{
sp.setLimitBy(LimitBy.FINAL_SIZE);
sp.setLimit(paging.getMaxItems());
sp.setSkipCount(paging.getSkipCount());
}
}
示例6: findBlogPosts
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的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;
}
示例7: findLinks
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
@Override
public PagingResults<LinkInfo> findLinks(String siteShortName, String user,
Date from, Date to, String tag, PagingRequest paging)
{
NodeRef container = getSiteLinksContainer(siteShortName, false);
if (container == null)
{
// No links
return new EmptyPagingResults<LinkInfo>();
}
// Build the query
StringBuilder luceneQuery = new StringBuilder();
luceneQuery.append(" +TYPE:\"" + LinksModel.TYPE_LINK + "\"");
luceneQuery.append(" +PATH:\"" + nodeService.getPath(container).toPrefixString(namespaceService) + "/*\"");
if (user != null)
{
luceneQuery.append(" [email protected]\\:creator:\"" + user + "\"");
}
if (from != null && to != null)
{
luceneQuery.append(LuceneUtils.createDateRangeQuery(
from, to, ContentModel.PROP_CREATED, dictionaryService, namespaceService));
}
if (tag != null)
{
luceneQuery.append(" +PATH:\"/cm:taggable/cm:" + ISO9075.encode(tag) + "/member\"");
}
String sortOn = "@{http://www.alfresco.org/model/content/1.0}created";
// Query
SearchParameters sp = new SearchParameters();
sp.addStore(container.getStoreRef());
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery(luceneQuery.toString());
sp.addSort(sortOn, false);
if (paging.getSkipCount() > 0)
{
sp.setSkipCount(paging.getSkipCount());
}
// Build the results
PagingResults<LinkInfo> pagedResults = new EmptyPagingResults<LinkInfo>();
ResultSet results = null;
try
{
results = searchService.query(sp);
pagedResults = wrap(results, container, paging);
}
finally
{
if (results != null)
{
results.close();
}
}
return pagedResults;
}
示例8: findTopics
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
@Override
public PagingResults<TopicInfo> findTopics(NodeRef nodeRef,
String username, String tag, boolean sortAscending, PagingRequest paging)
{
// Build the query
StringBuilder luceneQuery = new StringBuilder();
luceneQuery.append(" +TYPE:\"" + ForumModel.TYPE_TOPIC + "\"");
luceneQuery.append(" +PATH:\"" + nodeService.getPath(nodeRef).toPrefixString(namespaceService) + "/*\"");
if (username != null)
{
luceneQuery.append(" [email protected]\\:creator:\"" + username + "\"");
}
if (tag != null)
{
luceneQuery.append(" +PATH:\"/cm:taggable/cm:" + ISO9075.encode(tag) + "/member\"" );
}
String sortOn = "@{http://www.alfresco.org/model/content/1.0}created";
// Query
SearchParameters sp = new SearchParameters();
sp.addStore(nodeRef.getStoreRef());
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery(luceneQuery.toString());
sp.addSort(sortOn, sortAscending);
if (paging.getSkipCount() > 0)
{
sp.setSkipCount(paging.getSkipCount());
}
// Build the results
PagingResults<TopicInfo> pagedResults = new EmptyPagingResults<TopicInfo>();
ResultSet results = null;
try
{
results = searchService.query(sp);
pagedResults = wrap(results, nodeRef, paging);
}
finally
{
if (results != null)
{
results.close();
}
}
return pagedResults;
}
示例9: getAsSearchParmeters
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
/**
* @return SearchParameters
*/
public SearchParameters getAsSearchParmeters()
{
SearchParameters searchParameters = new SearchParameters();
searchParameters.setDefaultFieldName(this.getDefaultFieldName());
searchParameters.setDefaultFTSFieldConnective(this.getDefaultFTSFieldConnective() == Connective.OR ? SearchParameters.Operator.OR : SearchParameters.Operator.AND);
searchParameters.setDefaultFTSOperator(this.getDefaultFTSConnective() == Connective.OR ? SearchParameters.Operator.OR : SearchParameters.Operator.AND);
searchParameters.setDefaultOperator(this.getDefaultFTSConnective() == Connective.OR ? SearchParameters.Operator.OR : SearchParameters.Operator.AND);
searchParameters.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
if(this.getMaxItems() > 0)
{
searchParameters.setLimit(this.getMaxItems());
searchParameters.setLimitBy(LimitBy.FINAL_SIZE);
searchParameters.setMaxItems(this.getMaxItems());
}
searchParameters.setMaxPermissionChecks(this.getMaxPermissionChecks());
searchParameters.setMaxPermissionCheckTimeMillis(this.getMaxPermissionCheckTimeMillis());
searchParameters.setMlAnalaysisMode(this.getMlAnalaysisMode());
//searchParameters.setNamespace() TODO: Fix
//searchParameters.setPermissionEvaluation()
searchParameters.setQuery(this.getQuery());
searchParameters.setSkipCount(this.getSkipCount());
//searchParameters.addAllAttribute()
for(Locale locale : this.getLocales())
{
searchParameters.addLocale(locale);
}
for(QueryParameterDefinition queryParameterDefinition: this.getQueryParameterDefinitions())
{
searchParameters.addQueryParameterDefinition(queryParameterDefinition);
}
//searchParameters.addQueryTemplate(name, template)
//searchParameters.addSort()
for(StoreRef storeRef : this.getStores())
{
searchParameters.addStore(storeRef);
}
//searchParameters.addTextAttribute()
searchParameters.setQueryConsistency(this.getQueryConsistency());
searchParameters.setSinceTxId(getSinceTxId());
for(String name : getQueryTemplates().keySet())
{
String template = getQueryTemplates().get(name);
searchParameters.addQueryTemplate(name, template);
}
return searchParameters;
}
示例10: getAsSearchParmeters
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
/**
* @return SearchParameters
*/
public SearchParameters getAsSearchParmeters()
{
SearchParameters searchParameters = new SearchParameters();
searchParameters.setDefaultFieldName(this.getDefaultFieldName());
searchParameters.setDefaultFTSFieldConnective(this.getDefaultFTSFieldConnective() == Connective.OR ? SearchParameters.Operator.OR : SearchParameters.Operator.AND);
searchParameters.setDefaultFTSOperator(this.getDefaultFTSConnective() == Connective.OR ? SearchParameters.Operator.OR : SearchParameters.Operator.AND);
searchParameters.setDefaultOperator(this.getDefaultFTSConnective() == Connective.OR ? SearchParameters.Operator.OR : SearchParameters.Operator.AND);
searchParameters.setLanguage(SearchService.LANGUAGE_CMIS_ALFRESCO);
if(this.getMaxItems() > 0)
{
searchParameters.setLimit(this.getMaxItems());
searchParameters.setLimitBy(LimitBy.FINAL_SIZE);
searchParameters.setMaxItems(this.getMaxItems());
}
searchParameters.setMaxPermissionChecks(this.getMaxPermissionChecks());
searchParameters.setMaxPermissionCheckTimeMillis(this.getMaxPermissionCheckTimeMillis());
searchParameters.setMlAnalaysisMode(this.getMlAnalaysisMode());
//searchParameters.setNamespace() TODO: Fix
//searchParameters.setPermissionEvaluation()
searchParameters.setQuery(this.getQuery());
searchParameters.setSkipCount(this.getSkipCount());
//searchParameters.addAllAttribute()
for(Locale locale : this.getLocales())
{
searchParameters.addLocale(locale);
}
for(QueryParameterDefinition queryParameterDefinition: this.getQueryParameterDefinitions())
{
searchParameters.addQueryParameterDefinition(queryParameterDefinition);
}
//searchParameters.addQueryTemplate(name, template)
//searchParameters.addSort()
for(StoreRef storeRef : this.getStores())
{
searchParameters.addStore(storeRef);
}
//searchParameters.addTextAttribute()
searchParameters.setBulkFetchEnabled(isBulkFetchEnabled());
searchParameters.setQueryConsistency(this.getQueryConsistency());
searchParameters.setSinceTxId(getSinceTxId());
for(String name : getQueryTemplates().keySet())
{
String template = getQueryTemplates().get(name);
searchParameters.addQueryTemplate(name, template);
}
return searchParameters;
}
示例11: doSearch
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
/**
* Do the actual search
*
* @param searchQuery Pair with query string in first and query language in second
* @param sortAscending boolean
* @param paging PagingRequest
*/
protected PagingResults<TopicInfo> doSearch(Pair<String, String> searchQuery, boolean sortAscending, PagingRequest paging)
{
ResultSet resultSet = null;
PagingResults<TopicInfo> pagedResults = new EmptyPagingResults<TopicInfo>();
String sortOn = "@{http://www.alfresco.org/model/content/1.0}created";
// Setup the search parameters
SearchParameters sp = new SearchParameters();
sp.addStore(SPACES_STORE);
sp.setQuery(searchQuery.getFirst());
sp.setLanguage(searchQuery.getSecond());
sp.addSort(sortOn, sortAscending);
if (paging.getMaxItems() > 0)
{
//Multiply maxItems by 10. This is to catch topics that have multiple replies and ensure that the maximum number of topics is shown.
sp.setLimit(paging.getMaxItems()*10);
sp.setLimitBy(LimitBy.FINAL_SIZE);
}
if (paging.getSkipCount() > 0)
{
sp.setSkipCount(paging.getSkipCount());
}
try
{
resultSet = searchService.query(sp);
pagedResults = wrap(resultSet, paging);
}
finally
{
try
{
resultSet.close();
}
catch(Exception e)
{
//do nothing
}
}
return pagedResults;
}
示例12: findLinks
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
public CollectionWithPagingInfo<QuickShareLink> findLinks(Parameters parameters)
{
checkEnabled();
String queryString =
"ASPECT:\"" + QuickShareModel.ASPECT_QSHARE.toString() + "\"";
SearchParameters sp = new SearchParameters();
// note: REST API query parameter (ie. where clause filter) - not to be confused with search query ;-)
Query q = parameters.getQuery();
if (q != null)
{
// filtering via "where" clause
MapBasedQueryWalker propertyWalker = new MapBasedQueryWalker(FIND_SHARED_LINKS_QUERY_PROPERTIES, null);
QueryHelper.walk(q, propertyWalker);
String sharedByUserId = propertyWalker.getProperty(PARAM_SHAREDBY, WhereClauseParser.EQUALS, String.class);
if (sharedByUserId != null)
{
if (People.DEFAULT_USER.equalsIgnoreCase(sharedByUserId))
{
sharedByUserId = AuthenticationUtil.getFullyAuthenticatedUser();
}
QueryParameterDefinition qpd = new QueryParameterDefImpl(QuickShareModel.PROP_QSHARE_SHAREDBY, dictionaryService.getDataType(DataTypeDefinition.TEXT),
true, sharedByUserId);
sp.addQueryParameterDefinition(qpd);
String qsharedBy = QuickShareModel.PROP_QSHARE_SHAREDBY.toPrefixString(namespaceService);
queryString += " [email protected]"+SearchLanguageConversion.escapeLuceneQuery(qsharedBy)+":\"${"+qsharedBy+"}\"";
}
}
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery(queryString);
sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
Paging paging = parameters.getPaging();
PagingRequest pagingRequest = Util.getPagingRequest(paging);
sp.setSkipCount(pagingRequest.getSkipCount());
sp.setMaxItems(pagingRequest.getMaxItems());
sp.addSort("@" + ContentModel.PROP_MODIFIED, false);
ResultSet results = searchService.query(sp);
List<QuickShareLink> qsLinks = new ArrayList<>(results.length());
List<String> includeParam = parameters.getInclude();
for (ResultSetRow row : results)
{
NodeRef nodeRef = row.getNodeRef();
qsLinks.add(getQuickShareInfo(nodeRef, false, includeParam));
}
results.close();
return CollectionWithPagingInfo.asPaged(paging, qsLinks, results.hasMore(), new Long(results.getNumberFound()).intValue());
}
示例13: find
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
public CollectionWithPagingInfo<T> find(Parameters parameters,
String termName, int minTermLength, String queryTemplateName,
Sort sort, Map<String, QName> sortParamsToQNames, SortColumn... defaultSort)
{
SearchParameters sp = new SearchParameters();
sp.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO);
sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
sp.setDefaultFieldName(queryTemplateName);
String term = getTerm(parameters, termName, minTermLength);
StringBuilder query = new StringBuilder();
buildQuery(query, term, sp, queryTemplateName);
sp.setQuery(query.toString());
Paging paging = parameters.getPaging();
PagingRequest pagingRequest = Util.getPagingRequest(paging);
List<SortColumn> defaultSortCols = (defaultSort != null ? Arrays.asList(defaultSort) : Collections.emptyList());
if (sort == IN_QUERY_SORT)
{
addSortOrder(parameters, sortParamsToQNames, defaultSortCols, sp);
sp.setSkipCount(pagingRequest.getSkipCount());
sp.setMaxItems(pagingRequest.getMaxItems());
}
ResultSet queryResults = null;
List<T> collection = null;
try
{
queryResults = searchService.query(sp);
List<NodeRef> nodeRefs = queryResults.getNodeRefs();
if (sort == POST_QUERY_SORT)
{
nodeRefs = postQuerySort(parameters, sortParamsToQNames, defaultSortCols, nodeRefs);
}
collection = newList(nodeRefs.size());
List<String> includeParam = parameters.getInclude();
for (NodeRef nodeRef : nodeRefs)
{
T t = convert(nodeRef, includeParam);
collection.add(t);
}
if (sort == POST_QUERY_SORT)
{
return listPage(collection, paging);
}
else
{
return CollectionWithPagingInfo.asPaged(paging, collection, queryResults.hasMore(), new Long(queryResults.getNumberFound()).intValue());
}
}
finally
{
if (queryResults != null)
{
queryResults.close();
}
}
}