use of org.apache.chemistry.opencmis.commons.enums.CapabilityJoin in project SearchServices by Alfresco.
the class AlfrescoSolrDataModel method parseCMISQueryToAlfrescoAbstractQuery.
public org.alfresco.repo.search.impl.querymodel.Query parseCMISQueryToAlfrescoAbstractQuery(CMISQueryMode mode, SearchParameters searchParameters, SolrQueryRequest req, String alternativeDictionary, CmisVersion cmisVersion) {
// convert search parameters to cmis query options
// TODO: how to handle store ref
CMISQueryOptions options = new CMISQueryOptions(searchParameters.getQuery(), StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
options.setQueryMode(CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS);
options.setDefaultFieldName(searchParameters.getDefaultFieldName());
// TODO: options.setDefaultFTSConnective()
// TODO: options.setDefaultFTSFieldConnective()
options.setIncludeInTransactionData(!searchParameters.excludeDataInTheCurrentTransaction());
options.setLocales(searchParameters.getLocales());
options.setMlAnalaysisMode(searchParameters.getMlAnalaysisMode());
options.setQueryParameterDefinitions(searchParameters.getQueryParameterDefinitions());
for (String name : searchParameters.getQueryTemplates().keySet()) {
String template = searchParameters.getQueryTemplates().get(name);
options.addQueryTemplate(name, template);
}
// parse cmis syntax
CapabilityJoin joinSupport = (mode == CMISQueryMode.CMS_STRICT) ? CapabilityJoin.NONE : CapabilityJoin.INNERANDOUTER;
CmisFunctionEvaluationContext functionContext = getCMISFunctionEvaluationContext(mode, cmisVersion, alternativeDictionary);
CMISDictionaryService cmisDictionary = getCMISDictionary(alternativeDictionary, cmisVersion);
CMISQueryParser parser = new CMISQueryParser(options, cmisDictionary, joinSupport);
org.alfresco.repo.search.impl.querymodel.Query queryModelQuery = parser.parse(new LuceneQueryModelFactory<Query, Sort, SyntaxError>(), functionContext);
if (queryModelQuery.getSource() != null) {
List<Set<String>> selectorGroups = queryModelQuery.getSource().getSelectorGroups(functionContext);
if (selectorGroups.size() == 0) {
throw new UnsupportedOperationException("No selectors");
}
}
return queryModelQuery;
}
Aggregations