cancel
Showing results for 
Search instead for 
Did you mean: 

Search API and relativePath

pdovhomilja
Champ on-the-rise
Champ on-the-rise

Hello,

i'm looking for possibility how to use relativePath in Search API. I'm using this command

POST /alfresco/api/-default-/public/search/versions/1/search
{
  "query": {
    "language": "afts",
    "query": "=ssl:path:'mailroom/Unfinished'"
  },
  "paging": {
    "maxItems": 100,
    "skipCount": 0
  }
}

and i need to use relativePath in it. Why? It is not important, but i'm looking for how to for example get children from two different folders (and different sites) and use custom property search in the query. In the future i would like to filter results by my custom metadata.

Thanks fo help!

1 ACCEPTED ANSWER

Do you mean something like this?

{
  "query": {
    "language": "afts",
    "query": "PATH:'/app:company_home/st:sites/cm:swsdp/cm:documentLibrary/cm:Agency_x0020_Files//*' OR PATH:'/app:company_home/st:sites/cm:swsdp/cm:documentLibrary/cm:Budget_x0020_Files//*'"
  }
}
Hyland Developer Evangelist

View answer in original post

4 REPLIES 4

angelborroy
Community Manager Community Manager
Community Manager

Not sure if I understand your requirement.

You can try queries like the following to find every node in the system under a folder named test.

{
  "query": {
    "language": "afts",
    "query": "PATH:'//*/cm:test/*'"
  }
}
Hyland Developer Evangelist

Hi,

thanks this works, but i need to search everything with "relativePath" = "/Sites/Storage/documentLibrary/Documents". It is possible with PATH?

And can be used something like this with searching in more paths?

{
  "query": {
    "language": "afts",
    "query": "relativePath:'/Sites/Storage/documentLibrary/Documents' OR relativePath:'/Sites/Archive/documentLibrary/Files'"
  }

Thank you!

Do you mean something like this?

{
  "query": {
    "language": "afts",
    "query": "PATH:'/app:company_home/st:sites/cm:swsdp/cm:documentLibrary/cm:Agency_x0020_Files//*' OR PATH:'/app:company_home/st:sites/cm:swsdp/cm:documentLibrary/cm:Budget_x0020_Files//*'"
  }
}
Hyland Developer Evangelist

Exactly! THANK YOU VERY MUCH!!!