Extract files infos from specific folders using SEARCH_API

cancel
Showing results for 
Search instead for 
Did you mean: 
Bro
Member II

Extract files infos from specific folders using SEARCH_API

I created this query to find my folder location
{
        "query": {"language": "lucene",
        "query": "PATH:\"/app:company_home//*\" AND TYPE:\"cm:folder\" AND cm:name:\"my_folder\""},
        "include": ["path"],
        "paging":{"maxItems": my_item}
}
 
or 
 
{
        "query": {"language": "cmis",
        "query": "SELECT * FROM cmis:folder WHERE cmis:name='my_folder'"},
        "include": ["path"],
        "paging":{"maxItems": my_item}
}
 
How can I return all contents from defined folder ? I've to avoid multiples requests.
 
Thanks
 
5 Replies
angelborroy
Alfresco Employee

Re: Extract files infos from specific folders using SEARCH_API

Use CONTAINS clause combined with PATH expression.

https://pavelmakhov.com/2015/10/cmis-path-query/

Hyland Developer Evangelist
Bro
Member II

Re: Extract files infos from specific folders using SEARCH_API

It returns error 500

 

{
"query": {"language": "cmis",
"query": "select * from cmis:document
where contains("PATH:\"/app:company_home/st:sites/cm:MySite/cm:documentLibrary//*\" AND TYPE:\"cm:folder\" AND cm:name:\"MyFolder\"")"}
}

angelborroy
Alfresco Employee

Re: Extract files infos from specific folders using SEARCH_API

{
  "query": {
    "query": "select * from cmis:folder 
where cmis:name='MyFolder' AND
contains('PATH:\"/app:company_home/st:sites/cm:MySite/cm:documentLibrary//*\"')", "language": "cmis" } }
Hyland Developer Evangelist
Bro
Member II

Re: Extract files infos from specific folders using SEARCH_API

Sorry, but it doesn't even run that query. 

Is it possible to do that with lucene language ? From multiple folders ?

Thanks

angelborroy
Alfresco Employee

Re: Extract files infos from specific folders using SEARCH_API

{
  "query": {
    "query": "select * from cmis:folder where cmis:name='MyFolder' AND contains('PATH:\"/app:company_home/st:sites/cm:MySite/cm:documentLibrary//*\"')",
    "language": "cmis"
  }
}

This is working from my side, what error are you getting?

Hyland Developer Evangelist