Search in sources :

Example 1 with QueryOptions

use of org.alfresco.repo.search.impl.querymodel.QueryOptions in project alfresco-repository by Alfresco.

the class AbstractAlfrescoFtsQueryLanguage method executeQuery.

public ResultSet executeQuery(SearchParameters searchParameters) {
    String ftsExpression = searchParameters.getQuery();
    QueryModelFactory factory = queryEngine.getQueryModelFactory();
    AlfrescoFunctionEvaluationContext context = new AlfrescoFunctionEvaluationContext(namespaceService, dictionaryService, 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;
}
Also used : QueryEngineResults(org.alfresco.repo.search.impl.querymodel.QueryEngineResults) Constraint(org.alfresco.repo.search.impl.querymodel.Constraint) AlfrescoFunctionEvaluationContext(org.alfresco.repo.search.impl.parsers.AlfrescoFunctionEvaluationContext) FTSParser(org.alfresco.repo.search.impl.parsers.FTSParser) QueryOptions(org.alfresco.repo.search.impl.querymodel.QueryOptions) ResultSet(org.alfresco.service.cmr.search.ResultSet) QueryModelFactory(org.alfresco.repo.search.impl.querymodel.QueryModelFactory)

Aggregations

AlfrescoFunctionEvaluationContext (org.alfresco.repo.search.impl.parsers.AlfrescoFunctionEvaluationContext)1 FTSParser (org.alfresco.repo.search.impl.parsers.FTSParser)1 Constraint (org.alfresco.repo.search.impl.querymodel.Constraint)1 QueryEngineResults (org.alfresco.repo.search.impl.querymodel.QueryEngineResults)1 QueryModelFactory (org.alfresco.repo.search.impl.querymodel.QueryModelFactory)1 QueryOptions (org.alfresco.repo.search.impl.querymodel.QueryOptions)1 ResultSet (org.alfresco.service.cmr.search.ResultSet)1