AnsweredAssumed Answered

CONTAINS keyword usage in CMIS queries

Question asked by charlie.k on Sep 9, 2015
Latest reply on Jan 28, 2016 by s.palyukh
Hello,

I have CONTAINS keyword usage question. I am using Alfresco 5.0.d and trying to query my custom type objects via CMIS like this:
SELECT * FROM custom:type WHERE CONTAINS('test')


I tested this query via OpenCMIS Workbench. I expected to get all custom:type entries where at least one of my custom attributes has the text 'test'. But I guess I misunderstood how CONTAINS keyword works with CMIS - I get no results.

I found this earlier post which describes similar problem:
http://forums.alfresco.com/forum/developer-discussions/alfresco-api/cmis-contains-not-finding-documents-expected-03142011-1523
And I thought that this was fixed in version 3.4.3.. but it appears it is not the case.

I also tried this (same results as before):
SELECT * FROM custom:type WHERE CONTAINS('TEXT:test')

and this (I get an exception):
SELECT * FROM custom:type WHERE CONTAINS('ALL:test')

The latter query resulted in an error in workbench ("runtime: 08091542 Request failed 500 /solr4/alfresco/cmis…") and in alfresco logs:

ERROR [solr.core.SolrCore] [http-bio-8443-exec-3] java.lang.UnsupportedOperationException
   at org.alfresco.solr.query.Solr4QueryParser.createAllQuery(Solr4QueryParser.java:1005)
   at org.alfresco.solr.query.Solr4QueryParser.getFieldQuery(Solr4QueryParser.java:615)
   at org.alfresco.solr.query.Lucene4QueryParserAdaptor.getFieldQuery(Lucene4QueryParserAdaptor.java:67)
   at org.alfresco.solr.query.Lucene4QueryParserAdaptor.getFieldQuery(Lucene4QueryParserAdaptor.java:48)
   at org.alfresco.repo.search.impl.querymodel.impl.lucene.functions.LuceneFTSTerm.addComponent(LuceneFTSTerm.java:68)
   at org.alfresco.repo.search.impl.querymodel.impl.lucene.LuceneFunctionalConstraint.addComponent(LuceneFunctionalConstraint.java:57)
   at org.alfresco.repo.search.impl.querymodel.impl.lucene.LuceneQuery.buildQuery(LuceneQuery.java:105)
   at org.alfresco.solr.AlfrescoSolrDataModel.getCMISQuery(AlfrescoSolrDataModel.java:2004)
   at org.alfresco.solr.query.CmisQParserPlugin$CmisQParser.parse(CmisQParserPlugin.java:189)
   at org.apache.solr.search.QParser.getQuery(QParser.java:141)


So the questions at hand are:
How should CONTAINS keyword work?
Is it possible to achieve my requirement (search in all attributes, without specifying all of them in the query)?

Charlie

Outcomes