AnsweredAssumed Answered

Lucene query not working

Question asked by nancyaggarwal on Sep 4, 2015
Latest reply on Sep 4, 2015 by nancyaggarwal
hi,


I have written one webscript in alfresco for assigning user role on a folder. But the query which i have written for finding the folder is not working. Below is my webscript controller:



/*Set permission to a folder using Alfresco javascript API*/

//search for the folder node using lucene search

var folderNode =  search.luceneSearch('+PATH:"/app:company_home/cm:testing/*"  AND TYPE:\"cm:folder" AND @cm\\:name:"test"');

//make sure we only get one node
if(folderNode.length == 1){

//set permission "Contributor" to user with username "anythingalfresco" and group "ANYTHINGALFRESCOGROUP"

folderNode[0].setPermission("Contributor", user);
folderNode[0].setInheritsPermissions(false);
model.myStatus = "Permission was set successfully!";
}else  if (folderNode.length == 0){
//no node was found
model.myStatus = "Folder not found";
}else{
//either greater than two  was found
model.myStatus = "Duplicate folder found";
}



It is giving me folder not found error. I have test folder inside testing folder but still it is giving mr folder not found error.


Please help me what is wrong in my lucene query or is there something else which is not working.


Regards,
Nancy

Outcomes