当前位置: 首页>>代码示例>>Java>>正文


Java SearchParameters.getQuery方法代码示例

本文整理汇总了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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:IgnoreConstraint.java

示例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());
    }        
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:41,代码来源:ADMLuceneSearcherImpl.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:AbstractAlfrescoFtsQueryLanguage.java

示例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);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:SolrXPathQueryLanguage.java

示例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());
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:39,代码来源:SolrSearchService.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:NamePatternPropertyValueConstraint.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:FilesFoldersConstraint.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:PropertyValueConstraint.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:37,代码来源:QueryOptions.java

示例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;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:39,代码来源:CMISQueryOptions.java


注:本文中的org.alfresco.service.cmr.search.SearchParameters.getQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。