Search API and relativePath

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner

Search API and relativePath

Jump to solution

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 Solution

Accepted Solutions
Highlighted
Alfresco Employee

Re: Search API and relativePath

Jump to solution

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//*'"
  }
}
Software Engineer in Alfresco Search Team.

View solution in original post

4 Replies
Highlighted
Alfresco Employee

Re: Search API and relativePath

Jump to solution

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/*'"
  }
}
Software Engineer in Alfresco Search Team.
Highlighted
Partner

Re: Search API and relativePath

Jump to solution

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!

Highlighted
Alfresco Employee

Re: Search API and relativePath

Jump to solution

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//*'"
  }
}
Software Engineer in Alfresco Search Team.

View solution in original post

Highlighted
Partner

Re: Search API and relativePath

Jump to solution

Exactly! THANK YOU VERY MUCH!!!