In previous two posts we had discussed about significance of query in content management system, different types of queries supported by Alfresco, XPath Query in detail, ISO encoding of filename during XPath query creation.
In this article, I am going to introduce you to one more type of query supported by Alfresco that is Lucene Path Queries. This is similar to XPath query but it has many advantages over XPath query. So, let us explore that.
Syntax:
PATH:”/<NameSpacePrefixResolver>:<FolderName>/<NameSpacePrefixResolver>:<ChildFolderName>//.”
This query always start with “PATH” key word and then drill down path of particular folder under which we want to search the documents. The path to a node is the trail of QNames of the child relationships to get to the node.
Example:
For Instance if we want to navigate to following folder structure through our query we can create Path Query as follow.
To find all nodes at any depth below “Following Email Templates” including that folder
PATH:”/app:company_home/app:dictionary/app:email_templates/app:following//.”
To find the all nodes with QName “app:following” anywhere in the repository:
To find all the children of all the all nodes with QName ” app:following” anywhere in the repository:
PATH:”//app:following//*”
I would also like to add important note give on wiki page related to Path Query that is, if you have a large repository, increase the cache sizes to reflect common PATH queries otherwise your queries may be slower than expected.