本文整理汇总了Java中org.alfresco.service.cmr.search.SearchParameters.getQuery方法的典型用法代码示例。如果您正苦于以下问题:Java SearchParameters.getQuery方法的具体用法?Java SearchParameters.getQuery怎么用?Java SearchParameters.getQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.search.SearchParameters
的用法示例。
在下文中一共展示了SearchParameters.getQuery方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyFTSDecorations
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
private SearchParameters applyFTSDecorations(SearchParameters searchParameters, NamespacePrefixResolver nspResolver)
{
SearchParameters constrainedParameters = searchParameters.copy();
String theQuery = constrainedParameters.getQuery();
theQuery = "(" + theQuery + ")";
if (ignoreAspectQNames != null)
{
for (QName ignoredAspect : ignoreAspectQNames)
{
theQuery = theQuery + " and " + "!ASPECT:'" + ignoredAspect.toPrefixString(nspResolver) + "'";
}
}
if (ignoreTypeNames != null)
{
for (QName ignoredType : ignoreTypeNames)
{
theQuery = theQuery + " and " + "!TYPE:'" + ignoredType.toPrefixString(nspResolver) + "'";
}
}
constrainedParameters.setQuery(theQuery);
return constrainedParameters;
}
示例2: query
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
public ResultSet query(SearchParameters searchParameters)
{
if (searchParameters.getStores().size() != 1)
{
throw new IllegalStateException("Only one store can be searched at present");
}
ArrayList<StoreRef> stores = searchParameters.getStores();
stores.set(0, tenantService.getName(searchParameters.getStores().get(0)));
String parameterisedQueryString;
if (searchParameters.getQueryParameterDefinitions().size() > 0)
{
Map<QName, QueryParameterDefinition> map = new HashMap<QName, QueryParameterDefinition>();
for (QueryParameterDefinition qpd : searchParameters.getQueryParameterDefinitions())
{
map.put(qpd.getQName(), qpd);
}
parameterisedQueryString = parameterise(searchParameters.getQuery(), map, null, namespacePrefixResolver);
}
else
{
parameterisedQueryString = searchParameters.getQuery();
}
// TODO: add another property so the set query is not changed ...
// May be good to return the query as run ??
searchParameters.setQuery(parameterisedQueryString);
LuceneQueryLanguageSPI language = queryLanguages.get(searchParameters.getLanguage().toLowerCase());
if (language != null)
{
return language.executeQuery(searchParameters, this);
}
else
{
throw new SearcherException("Unknown query language: " + searchParameters.getLanguage());
}
}
示例3: executeQuery
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
public ResultSet executeQuery(SearchParameters searchParameters, ADMLuceneSearcherImpl admLuceneSearcher)
{
String ftsExpression = searchParameters.getQuery();
QueryModelFactory factory = queryEngine.getQueryModelFactory();
AlfrescoFunctionEvaluationContext context = new AlfrescoFunctionEvaluationContext(getNamespacePrefixResolver(admLuceneSearcher), getDictionaryService(admLuceneSearcher),
searchParameters.getNamespace());
QueryOptions options = QueryOptions.create(searchParameters);
FTSParser.Mode mode;
if(options.getDefaultFTSConnective() == Connective.AND)
{
mode = FTSParser.Mode.DEFAULT_CONJUNCTION;
}
else
{
mode = FTSParser.Mode.DEFAULT_DISJUNCTION;
}
Constraint constraint = FTSQueryParser.buildFTS(ftsExpression, factory, context, null, null, mode, options.getDefaultFTSFieldConnective(),
searchParameters.getQueryTemplates(), options.getDefaultFieldName(), FTSQueryParser.RerankPhase.SINGLE_PASS);
org.alfresco.repo.search.impl.querymodel.Query query = factory.createQuery(null, null, constraint, buildOrderings(factory, searchParameters));
QueryEngineResults results = queryEngine.executeQuery(query, options, context);
ResultSet resultSet = results.getResults().values().iterator().next();
return resultSet;
}
示例4: executeQuery
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
@Override
public ResultSet executeQuery(SearchParameters searchParameters, ADMLuceneSearcherImpl admLuceneSearcher)
{
String query = "PATH:\""+searchParameters.getQuery()+"\"";
SearchParameters sp = searchParameters.copy();
sp.setLanguage(SearchService.LANGUAGE_SOLR_FTS_ALFRESCO);
sp.setQuery(query);
return solrQueryLanguage.executeQuery(sp, admLuceneSearcher);
}
示例5: query
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
@Override
public ResultSet query(SearchParameters searchParameters)
{
if(searchParameters.getStores().size() == 0)
{
throw new IllegalStateException("At least one store must be defined to search");
}
String parameterisedQueryString;
if (searchParameters.getQueryParameterDefinitions().size() > 0)
{
Map<QName, QueryParameterDefinition> map = new HashMap<QName, QueryParameterDefinition>();
for (QueryParameterDefinition qpd : searchParameters.getQueryParameterDefinitions())
{
map.put(qpd.getQName(), qpd);
}
parameterisedQueryString = parameterise(searchParameters.getQuery(), map, null, namespacePrefixResolver);
}
else
{
parameterisedQueryString = searchParameters.getQuery();
}
// TODO: add another property so the set query is not changed ...
// May be good to return the query as run ??
searchParameters.setQuery(parameterisedQueryString);
LuceneQueryLanguageSPI language = queryLanguages.get(searchParameters.getLanguage().toLowerCase());
if (language != null)
{
return language.executeQuery(searchParameters, null);
}
else
{
throw new SearcherException("Unknown query language: " + searchParameters.getLanguage());
}
}
示例6: applyFTS
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
@Override
protected SearchParameters applyFTS(SearchParameters searchParameters)
{
String filePattern;
StringBuffer luceneReserved = new StringBuffer();
for(int i=0;i<value.toString().length();i++){
if(SearchLanguageConversion.DEF_LUCENE.isReserved(value.toString().charAt(i))){
luceneReserved.append(value.toString().charAt(i));
}
}
String luceneReservedStr=luceneReserved.toString();
String pattern =org.alfresco.util.ISO9075.encode(value.toString());
for (int i = 0; i < luceneReservedStr.length(); i++)
{
pattern = pattern.replace(org.alfresco.util.ISO9075.encode(luceneReservedStr.substring(i,i + 1)),
luceneReservedStr.substring(i,i + 1));
}
filePattern=SearchLanguageConversion.escapeForLucene(pattern);
SearchParameters constrainedParameters = searchParameters.copy();
String theQuery = constrainedParameters.getQuery();
StringBuilder sb = new StringBuilder();
sb.append("(" + theQuery + ")");
sb.append(" and (");
sb.append("TEXT:(").append(filePattern).append(") ");
sb.append("or (");
sb.append(" =").append(property.toPrefixString(this.nspResolver));
sb.append(":").append(filePattern);
sb.append(" ) ");
sb.append(")");
theQuery = sb.toString();
constrainedParameters.setQuery(theQuery);
return constrainedParameters;
}
示例7: applyDecorations
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
@Override
protected SearchParameters applyDecorations(ActualEnvironment environment, SearchParameters searchParameters,
VirtualQuery query)
{
String queryString = searchParameters.getQuery();
String language = searchParameters.getLanguage();
String filteredQuery = filter(language,
queryString,
files,
folders);
SearchParameters searchParametersCopy = searchParameters.copy();
searchParametersCopy.setQuery(filteredQuery);
return searchParametersCopy;
}
示例8: applyFTS
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
protected SearchParameters applyFTS(SearchParameters searchParameters)
{
SearchParameters constrainedParameters = searchParameters.copy();
String theQuery = constrainedParameters.getQuery();
// TODO: introduce and use operator
theQuery = "(" + theQuery + ")" + " and " + "( " + "=" + property.toPrefixString(this.nspResolver) + ":"
+"\""+value.toString() + "\" )";
constrainedParameters.setQuery(theQuery);
return constrainedParameters;
}
示例9: create
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
public static QueryOptions create(SearchParameters searchParameters)
{
QueryOptions options = new QueryOptions(searchParameters.getQuery(), null);
options.setIncludeInTransactionData(!searchParameters.excludeDataInTheCurrentTransaction());
options.setDefaultFTSConnective(searchParameters.getDefaultOperator() == SearchParameters.Operator.OR ? Connective.OR : Connective.AND);
options.setDefaultFTSFieldConnective(searchParameters.getDefaultOperator() == SearchParameters.Operator.OR ? Connective.OR : Connective.AND);
options.setSkipCount(searchParameters.getSkipCount());
options.setMaxPermissionChecks(searchParameters.getMaxPermissionChecks());
options.setMaxPermissionCheckTimeMillis(searchParameters.getMaxPermissionCheckTimeMillis());
options.setDefaultFieldName(searchParameters.getDefaultFieldName());
if (searchParameters.getLimitBy() == LimitBy.FINAL_SIZE)
{
options.setMaxItems(searchParameters.getLimit());
}
else
{
options.setMaxItems(searchParameters.getMaxItems());
}
options.setMlAnalaysisMode(searchParameters.getMlAnalaysisMode());
options.setLocales(searchParameters.getLocales());
options.setStores(searchParameters.getStores());
options.setQueryParameterDefinitions(searchParameters.getQueryParameterDefinitions());
///options.setQuery(query); Done on construction.
options.setUseInMemorySort(searchParameters.getUseInMemorySort());
options.setMaxRawResultSetSizeForInMemorySort(searchParameters.getMaxRawResultSetSizeForInMemorySort());
options.setBulkFetchEnabled(searchParameters.isBulkFetchEnabled());
options.setExcludeTenantFilter(searchParameters.getExcludeTenantFilter());
options.setQueryConsistency(searchParameters.getQueryConsistency());
options.setSinceTxId(searchParameters.getSinceTxId());
for(String name : searchParameters.getQueryTemplates().keySet())
{
String template = searchParameters.getQueryTemplates().get(name);
options.addQueryTemplate(name, template);
}
return options;
}
示例10: create
import org.alfresco.service.cmr.search.SearchParameters; //导入方法依赖的package包/类
public static CMISQueryOptions create(SearchParameters searchParameters)
{
String sql = searchParameters.getQuery();
CMISQueryOptions options = new CMISQueryOptions(sql, searchParameters.getStores().get(0));
options.setIncludeInTransactionData(!searchParameters.excludeDataInTheCurrentTransaction());
options.setDefaultFTSConnective(searchParameters.getDefaultOperator() == SearchParameters.Operator.OR ? Connective.OR : Connective.AND);
options.setDefaultFTSFieldConnective(searchParameters.getDefaultOperator() == SearchParameters.Operator.OR ? Connective.OR : Connective.AND);
options.setSkipCount(searchParameters.getSkipCount());
options.setMaxPermissionChecks(searchParameters.getMaxPermissionChecks());
options.setMaxPermissionCheckTimeMillis(searchParameters.getMaxPermissionCheckTimeMillis());
if (searchParameters.getLimitBy() == LimitBy.FINAL_SIZE)
{
options.setMaxItems(searchParameters.getLimit());
}
else
{
options.setMaxItems(searchParameters.getMaxItems());
}
options.setMlAnalaysisMode(searchParameters.getMlAnalaysisMode());
options.setLocales(searchParameters.getLocales());
options.setStores(searchParameters.getStores());
options.setUseInMemorySort(searchParameters.getUseInMemorySort());
options.setMaxRawResultSetSizeForInMemorySort(searchParameters.getMaxRawResultSetSizeForInMemorySort());
//options.setQuery(); Done on conbstruction
//options.setQueryMode(); Should set afterwards
options.setQueryParameterDefinitions(searchParameters.getQueryParameterDefinitions());
options.setDefaultFieldName(searchParameters.getDefaultFieldName());
options.setBulkFetchEnabled(searchParameters.isBulkFetchEnabled());
options.setExcludeTenantFilter(searchParameters.getExcludeTenantFilter());
options.setSinceTxId(searchParameters.getSinceTxId());
for(String name : searchParameters.getQueryTemplates().keySet())
{
String template = searchParameters.getQueryTemplates().get(name);
options.addQueryTemplate(name, template);
}
return options;
}