本文整理汇总了Java中org.alfresco.service.cmr.search.SearchParameters.setMaxItems方法的典型用法代码示例。如果您正苦于以下问题:Java SearchParameters.setMaxItems方法的具体用法?Java SearchParameters.setMaxItems怎么用?Java SearchParameters.setMaxItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.search.SearchParameters
的用法示例。
在下文中一共展示了SearchParameters.setMaxItems方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: getChildren
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
private Collection<ChildAssociationRef> getChildren(NodeRef categoryRef, Mode mode, Depth depth, boolean sortByName, String filter, int fetchSize)
{
if (categoryRef == null)
{
return Collections.<ChildAssociationRef> emptyList();
}
categoryRef = tenantService.getBaseName(categoryRef); // for solr
ResultSet resultSet = null;
try
{
StringBuilder luceneQuery = new StringBuilder(64);
switch (mode)
{
case ALL:
luceneQuery.append("PATH:\"");
luceneQuery.append(buildXPath(nodeService.getPath(categoryRef))).append("/");
if (depth.equals(Depth.ANY))
{
luceneQuery.append("/");
}
luceneQuery.append("*").append("\" ");
break;
case MEMBERS:
luceneQuery.append("PATH:\"");
luceneQuery.append(buildXPath(nodeService.getPath(categoryRef))).append("/");
if (depth.equals(Depth.ANY))
{
luceneQuery.append("/");
}
luceneQuery.append("member").append("\" ");
break;
case SUB_CATEGORIES:
luceneQuery.append("+PATH:\"");
luceneQuery.append(buildXPath(nodeService.getPath(categoryRef))).append("/");
if (depth.equals(Depth.ANY))
{
luceneQuery.append("/");
}
luceneQuery.append("*").append("\" ");
luceneQuery.append("+TYPE:\"" + ContentModel.TYPE_CATEGORY.toString() + "\"");
break;
}
if (filter != null)
{
luceneQuery.append(" " + "[email protected]\\:name:\"*" + filter + "*\"");
}
// Get a searcher that will include Categories added in this transaction
SearchService searcher = indexerAndSearcher.getSearcher(categoryRef.getStoreRef(), true);
// Perform the search
SearchParameters searchParameters = new SearchParameters();
resultSet = searcher.query(categoryRef.getStoreRef(), "lucene", luceneQuery.toString(), null);
searchParameters.setLanguage("lucene");
if(sortByName)
{
searchParameters.addSort("@" + ContentModel.PROP_NAME, true);
}
searchParameters.setQuery(luceneQuery.toString());
searchParameters.setLimit(-1);
searchParameters.setMaxItems(fetchSize);
searchParameters.setLimitBy(LimitBy.FINAL_SIZE);
searchParameters.addStore(categoryRef.getStoreRef());
resultSet = searcher.query(searchParameters);
// Convert from search results to the required Child Assocs
return resultSetToChildAssocCollection(resultSet);
}
finally
{
if (resultSet != null)
{
resultSet.close();
}
}
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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());
}
示例9: 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();
}
}
}