10-31-2018 07:48 AM
Hi,
I have one site "mySite" with "documentLibrary". Inside I have "PATIENTS" folder :
I don't find the way, in javascript, to get all sub-folders of "PATIENTS" folder starting by "CA" for example.
I have tried differents method with :
search.query({query: "PATH:/app:company_home/st:sites/cm:mySite/cm:documentLibrary/cmATIENTS//*"});
OR
search.xpathSearch("/app:company_home/st:sites/cm:mySite/cm:documentLibrary/cmATIENTS//*");
OR
search.luceneSearch("TYPE:\"cm:folder\" AND @cm\\:title:\"*"+filterTerm+"*\"");
without success...
Thank you
PS : each sub-folder is created by a java mechanism. Is-it possible that a parameter or an action ( may-be permission), during the sub-folder creation, can cancel the sub-folder scan ?
Thank you
10-31-2018 04:46 PM
Never use the luceneSearch operation. It is a legacy remnant and no longer receives any enhancements... Also xpathSearch is not a real XPath search, also going via the legacy Lucene search language with a very reduced XPath subset.
Always stick to query() in Repository-tier JavaScript. I am also wondering why you are querying for "...PATIENTS//*" - this will yield not only the sub-folders, but any descendant node below that folder at any depth. If you only want subfolders, you should simplify the PATH to "...PATIENTS/*" (single slash).
If you want to restrict based on the prefix of the name, you can simply add another condition to your query using AND. E.g. you can append
AND =cm:name:"AC*"
to query for all sub-folders / descendants with a name starting with AC (case-sensitive)
Explore our Alfresco products with the links below. Use labels to filter content by product module.