cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS query, cmis:path in WHERE clause

http
Champ in-the-making
Champ in-the-making
Hi all,

I'm using the CMIS query language. A basic query like
SELECT * FROM cmis:folder WHERE cmis:name='dataLists'
works fine.

However, when querying the cmisSmiley Tongueath property, I get an Internal Server error.
SELECT * FROM cmis:folder WHERE cmis:path='dataLists'
I expect the above query to return 0 resutls, instead I see an exception in the logs:
11:01:46,065 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Time to execute script: 6.942148ms
11:01:46,066 ERROR [org.springframework.extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 03050036 Wrapped Exception (with status template): 03057978 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js': 03057977 Request failed 500 /solr/alfresco/cmis?q=SELECT+cmis%3Apath+FROM+cmis%3Afolder+WHERE+cmis%3Apath+%3D+%27dataLists%27&wt=json&fl=*%2Cscore&rows=2147483647&df=TEXT&start=0&locale=en_US&fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&fq=%7B%21afts%7DTENANT_FILTER_FROM_JSON
org.springframework.extensions.webscripts.WebScriptException: 03050036 Wrapped Exception (with status template): 03057978 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js': 03057977 Request failed 500 /solr/alfresco/cmis?q=SELECT+cmis%3Apath+FROM+cmis%3Afolder+WHERE+cmis%3Apath+%3D+%27dataLists%27&wt=json&fl=*%2Cscore&rows=2147483647&df=TEXT&start=0&locale=en_US&fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&fq=%7B%21afts%7DTENANT_FILTER_FROM_JSON
   at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:970)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
   at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:393)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:662)
Caused by: org.alfresco.scripts.ScriptException: 03057978 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js': 03057977 Request failed 500 /solr/alfresco/cmis?q=SELECT+cmis%3Apath+FROM+cmis%3Afolder+WHERE+cmis%3Apath+%3D+%27dataLists%27&wt=json&fl=*%2Cscore&rows=2147483647&df=TEXT&start=0&locale=en_US&fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&fq=%7B%21afts%7DTENANT_FILTER_FROM_JSON
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:195)
   at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:212)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:174)
   at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
   at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1193)
   at org.alfresco.repo.cmis.rest.CMISWebScript.executeScript(CMISWebScript.java:46)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
   … 25 more
Caused by: org.alfresco.repo.search.impl.lucene.LuceneQueryParserException: 03057977 Request failed 500 /solr/alfresco/cmis?q=SELECT+cmis%3Apath+FROM+cmis%3Afolder+WHERE+cmis%3Apath+%3D+%27dataLists%27&wt=json&fl=*%2Cscore&rows=2147483647&df=TEXT&start=0&locale=en_US&fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&fq=%7B%21afts%7DTENANT_FILTER_FROM_JSON
   at org.alfresco.repo.search.impl.solr.SolrQueryHTTPClient.executeQuery(SolrQueryHTTPClient.java:333)
   at org.alfresco.repo.search.impl.solr.SolrQueryLanguage.executeQuery(SolrQueryLanguage.java:49)
   at org.alfresco.repo.search.impl.solr.SolrCMISQueryServiceImpl.query(SolrCMISQueryServiceImpl.java:93)
   at sun.reflect.GeneratedMethodAccessor830.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.management.subsystems.SubsystemProxyFactory$1.invoke(SubsystemProxyFactory.java:65)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy140.query(Unknown Source)
   at org.alfresco.repo.cmis.rest.CMISScript.query(CMISScript.java:683)
   at sun.reflect.GeneratedMethodAccessor829.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
   at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
   at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
   at org.mozilla.javascript.gen.c16._c0(file:/opt/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js:67)
   at org.mozilla.javascript.gen.c16.call(file:/opt/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js)
   at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
   at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
   at org.mozilla.javascript.gen.c16.call(file:/opt/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js)
   at org.mozilla.javascript.gen.c16.exec(file:/opt/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/cmis/queries.post.cmisquery.js)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:483)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:191)
   … 31 more

Probably, I'm doing something wrong. Can you please point out my mistake?

I'd like to do a query to find a node with a given path, e.g. /Sites/mysite/dataLists
9 REPLIES 9

mitpatoliya
Star Collaborator
Star Collaborator
that is because in that query with WHERE clause you can only use the queryable properties.Where cmisSmiley Tongueath is not one of those property.

http
Champ in-the-making
Champ in-the-making
thanks for pointing this out. i've overlooked this in the documentation: http://wiki.alfresco.com/wiki/CMIS_Query_Language#cmis:folder

is there a way to query cmisSmiley Tongueath using CONTAINS() ?

andy
Champ on-the-rise
Champ on-the-rise
Hi

You can use the standard Alfrecso path ueing

….CONTAINS('PATH:"//."')

Andy

http
Champ in-the-making
Champ in-the-making
Hi Andy,

a query for CONTAINS('PATH:"//."') returns all repository items, indeed.
how do I query for the repository item with a certain path, say /Sites/mysite/documentLibrary/MyFolder ?

as far as i can understand the documentation, the PATH queries are for querying the type of objects (as opposed to their cmisSmiley Tongueath property) http://wiki.alfresco.com/wiki/Search#Path_Queries

thanks,
gabor

mitpatoliya
Star Collaborator
Star Collaborator
No, I think you get it wrong.
Path Queries are to narrow down the search at particular location.
You  can get all the documents residing under particular path using path query.

Generally this path query is user along with other property based query and aspect based query.
Hope this is clear now.

http
Champ in-the-making
Champ in-the-making
I was not able to narrow down the search by path.
Looking for all folders within MyFolder with the path /Sites/mysite/documentLibrary/MyFolder.
SELECT * FROM cmis:folder WHERE CONTAINS('PATH:"/Sites/mysite/documentLibrary/MyFolder"')
The above query returns no results.
Probably I'm getting the syntax within the CONTAINS predicate wrong.

How do I query for folders located below a certain path?

Would I have the the objectId of MyFolder, I could use IN_FOLDER or IN_TREE predicates. However, I have to query based on path.

thanks in advance,
gabor

andy
Champ on-the-rise
Champ on-the-rise
Hi

You can use the node browser in share to get the PATH. It will be something like:

/app:company_home/st:sites/cm:swsdp/cm:documentLibrary/cmSmiley Tongueresentations

with ISO 9075 escaping as required for the path elements

Andy

johnny_k
Confirmed Champ
Confirmed Champ
Hello Andy
Can u tell me how i can get all folder from site
and other query all files in folder
i am trying use somethink like   SELECT * FROM cmis:folder WHERE CONTAINS('PATH:"/Sites/mysite/documentLibrary/MyFolder"')
but i get only empty table

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

Solution of my question =))