vegemite4me
vegemite4me

Reputation: 6896

Alfresco: Unable to CMIS query by path

I am trying to find out the contents of a folder in Alfresco, using the following CMIS query:

SELECT * 
FROM cmis:document 
WHERE CONTAINS('PATH:"/app:company_home/st:sites/cm:GM/cm:emir/cm:FAQ//*"')

In Node Browser, if I navigate to that folder I see the following value for Primary Path

(I have added line breaks to make it easier to read):

/{http://www.alfresco.org/model/application/1.0}company_home
/{http://www.alfresco.org/model/site/1.0}sites
/{http://www.alfresco.org/model/content/1.0}GM
/{http://www.alfresco.org/model/content/1.0}EMIR
/{http://www.alfresco.org/model/content/1.0}FAQ

But Alfresco is failing with the following message:

Caused by: org.alfresco.scripts.ScriptException: 05120032 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js': 05120 031 Unknown column/property PATH

I am testing against Alfresco Community 3.3.

Upvotes: 1

Views: 5670

Answers (2)

Francesco Lo Cascio
Francesco Lo Cascio

Reputation: 154

You can use the following query for simple search

SELECT * FROM cmis:document WHERE IN_FOLDER('id_of_folder')

or the following query for recursive search

SELECT * FROM cmis:document WHERE IN_TREE('id_of_folder').

if you want search by path, you can use:

SELECT * FROM cmis:folder 
WHERE CONTAINS('PATH:\"/app:company_home/st:sites/cm:my_site/cm:documentLibrary//*\"')

For more details view also the official specification

http://docs.oasis-open.org/cmis/CMIS/v1.1/os/CMIS-v1.1-os.html

Upvotes: 6

Andreas Steffan
Andreas Steffan

Reputation: 6169

Do yourself a favor and upgrade.

Your query works for me in the share node browser (does not throw exceptions) as either cmis-strict or cmis-alfresco .

SELECT * 
FROM cmis:document 
WHERE CONTAINS('PATH:"/app:company_home/st:sites//*"')

Gives me a whole lot of results.

Upvotes: 3

Related Questions