问题
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.
回答1:
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
回答2:
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.
来源:https://stackoverflow.com/questions/24190975/alfresco-unable-to-cmis-query-by-path