Search in sources :

Example 1 with DBQueryModelFactory

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

the class DbCmisQueryLanguage method executeQueryImpl.

private ResultSet executeQueryImpl(SearchParameters searchParameters) {
    CMISQueryOptions options = CMISQueryOptions.create(searchParameters);
    options.setQueryMode(CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS);
    CapabilityJoin joinSupport = CapabilityJoin.INNERANDOUTER;
    BaseTypeId[] validScopes = CmisFunctionEvaluationContext.ALFRESCO_SCOPES;
    CmisFunctionEvaluationContext functionContext = new CmisFunctionEvaluationContext();
    functionContext.setCmisDictionaryService(cmisDictionaryService);
    functionContext.setValidScopes(validScopes);
    CMISQueryParser parser = new CMISQueryParser(options, cmisDictionaryService, joinSupport);
    org.alfresco.repo.search.impl.querymodel.Query queryModelQuery = parser.parse(new DBQueryModelFactory(), functionContext);
    // TODO: Remove as this appears to be dead code
    // // build lucene query
    // Set<String> selectorGroup = null;
    // if (queryModelQuery.getSource() != null)
    // {
    // List<Set<String>> selectorGroups = queryModelQuery.getSource().getSelectorGroups(functionContext);
    // if (selectorGroups.size() == 0)
    // {
    // throw new UnsupportedOperationException("No selectors");
    // }
    // if (selectorGroups.size() > 1)
    // {
    // throw new UnsupportedOperationException("Advanced join is not supported");
    // }
    // selectorGroup = selectorGroups.get(0);
    // }
    // 
    QueryEngineResults results = queryEngine.executeQuery(queryModelQuery, options, functionContext);
    ResultSet resultSet = results.getResults().values().iterator().next();
    return resultSet;
}
Also used : QueryEngineResults(org.alfresco.repo.search.impl.querymodel.QueryEngineResults) CmisFunctionEvaluationContext(org.alfresco.opencmis.search.CmisFunctionEvaluationContext) BaseTypeId(org.apache.chemistry.opencmis.commons.enums.BaseTypeId) CapabilityJoin(org.apache.chemistry.opencmis.commons.enums.CapabilityJoin) CMISQueryOptions(org.alfresco.opencmis.search.CMISQueryOptions) ResultSet(org.alfresco.service.cmr.search.ResultSet) CMISQueryParser(org.alfresco.opencmis.search.CMISQueryParser) DBQueryModelFactory(org.alfresco.repo.search.impl.querymodel.impl.db.DBQueryModelFactory)

Aggregations

CMISQueryOptions (org.alfresco.opencmis.search.CMISQueryOptions)1 CMISQueryParser (org.alfresco.opencmis.search.CMISQueryParser)1 CmisFunctionEvaluationContext (org.alfresco.opencmis.search.CmisFunctionEvaluationContext)1 QueryEngineResults (org.alfresco.repo.search.impl.querymodel.QueryEngineResults)1 DBQueryModelFactory (org.alfresco.repo.search.impl.querymodel.impl.db.DBQueryModelFactory)1 ResultSet (org.alfresco.service.cmr.search.ResultSet)1 BaseTypeId (org.apache.chemistry.opencmis.commons.enums.BaseTypeId)1 CapabilityJoin (org.apache.chemistry.opencmis.commons.enums.CapabilityJoin)1