本文整理汇总了Java中org.alfresco.service.cmr.search.SearchParameters.setDefaultFieldName方法的典型用法代码示例。如果您正苦于以下问题:Java SearchParameters.setDefaultFieldName方法的具体用法?Java SearchParameters.setDefaultFieldName怎么用?Java SearchParameters.setDefaultFieldName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.search.SearchParameters
的用法示例。
在下文中一共展示了SearchParameters.setDefaultFieldName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromDefault
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
/**
* SearchParameters from Default object
* @param sp SearchParameters
* @param defaults Default
*/
public void fromDefault(SearchParameters sp, Default defaults)
{
if (defaults != null)
{
List<String> txtAttribs = defaults.getTextAttributes();
if (txtAttribs!= null && !txtAttribs.isEmpty())
{
for (String attrib:txtAttribs)
{
sp.addTextAttribute(attrib);
}
}
if (defaults.getDefaultFTSOperator() != null)
{
sp.setDefaultFTSOperator(Operator.valueOf(defaults.getDefaultFTSOperator().toUpperCase()));
}
if (defaults.getDefaultFTSFieldOperator() != null)
{
sp.setDefaultFTSFieldConnective(Operator.valueOf(defaults.getDefaultFTSFieldOperator().toUpperCase()));
}
sp.setNamespace(defaults.getNamespace());
sp.setDefaultFieldName(defaults.getDefaultFieldName());
}
}
示例2: 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;
}
示例3: 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;
}
示例4: 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();
}
}
}