How to put relative path on Smart Folders query?

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

How to put relative path on Smart Folders query?

Hi,

I have following structure of physical and smart folder:

Directory-One

+-Subdir-1

|

+-Subdir-2

|

+-MySmartFolder <--- smart folder directory

On my smart folder search query path, how to define the 'relative path' instead of absolute path (e.g. PATH:'/app:company_home/st:sites/cm:finance-site/cm:documentLibrary/cm:report-1/*') ?

The path I want to search is under directory "Directory-One" or parent folder, so I will get Subdir-1 and Subdir-2 as well.

The search query will be put on MySmartFolder directory (smart folder template).

Secondly, I need this approach since I want to create a custom smart folder applied into "space template". So, when I create a "folder from template" -- this new physical folder will have a custom smart folder which contains a relative path to its current location/path.

I've tried with . (prompt) sign, self, self::node() to PATH parameters were failed.

How to solve this problem?

Thank you,

[bayu]

7 Replies
afaust
Master

Re: How to put relative path on Smart Folders query?

There is no such thing as a relative path for the Alfresco FTS query syntax which is used to define the query for virtual folders. You always have to use a path starting from the root.

billydekid
Established Member II

Re: How to put relative path on Smart Folders query?

Thank you ‌.

So, what's the best approach to make smart folders are inside dynamic (physical) folders created?

My smart folders are functions to detect an aspect of folders which their parent folder were created dynamically / projects or cases based.

Thank you,-

afaust
Master

Re: How to put relative path on Smart Folders query?

If you need dynamic smart folders you may have to implement a script / behaviour to dynamically create the query template based on the (parent) folder with the specific aspect.

billydekid
Established Member II

Re: How to put relative path on Smart Folders query?

OK, I will try and update it here.

Thank you so much!

peterk
Member II

Re: How to put relative path on Smart Folders query?

Did You solve this problem, Bayu? I have the same or a similar one: I have a folder "A" with a type based smart folder "B" in it. I want the smart folder query to show only the results from the folder "A" where the smart folder "B" is in. How can I achieve that?

Axel Faust said, implement a script. But where has the script to reside and when is it supposed to be executed?

billydekid
Established Member II

Re: How to put relative path on Smart Folders query?

Hi Peter,

My question is come when I want to implement it as a template folder (Repository > Data Dictionary > Space Templates), hence when the folder created it will have a relative query to its parent. But as Axel said it couldn't do this approach since smart folder doesn't support relative path. I thought you can still query with absolute path.

Actually I drop this requirement (space templates approach) and create a Javascript based behavior solution as explained in Jeff Potts' blog:
Implementing Custom Behaviors in Alfresco | ECMArchitect | Alfresco Developer Tutorials 

Hope it helps.

Thank you,

[bayu]

peterk
Member II

Re: How to put relative path on Smart Folders query?

Hey,

I found a solution, at least for my use case:

I added to my query:

...  and (=PARENT:'<sys:store-protocol>://<sys:store-identifier>/<sys:node-uuid>' or =PRIMARYPARENT:'<sys:store-protocol>://<sys:store-identifier>/<sys:node-uuid>')

This way I limit my search on items, who's Parent or Primary Parent NodeRef is equal to the NodeRef of the physical parent folder of my current smart folder location.