AnsweredAssumed Answered

Alfresco Search in WebScripts

Question asked by kamesh.sampath on Aug 8, 2011

I am trying to search my Store with "StoreId" with the following webscript, my webscript controller file.

var storeId = args["storeId"];
var newsNodes = new Array();
if (storeId != null) {
   var webProjectStore = avm.lookupStore(storeId);
   if (webProjectStore != null) {
      var queryForNews = "@wca\\:parentformname:news AND @cm\\:folder:\"/ROOT/content/common/source\" AND @cm\\:name:\"*.xml\"";
      logger.log("Query for News:"+queryForNews);
      var resultNodes = webProjectStore.luceneSearch(queryForNews);
      if (resultNodes != null) {
         logger.log("Result nodes: " + resultNodes.length);
         for ( var i = 0; i < resultNodes.length; i++) {
            newsNodes[i] = resultNodes[i];
   if (newsNodes != null) {
      model.m_newsNodes = newsNodes;
} else {
   logger.log("ERROR: 'store' argument not specified.");

What I was trying is to search all web content created using form "news" which are under the folder "ROOT/content/common/source" and name is anything that ends with xml –> *.xml.

When i have my content @ ROOT/ and dont use the @cm:folder clause in the query everything works as expected, but Unfortunately my webscript is not resulting any results if i move my content files *.xml under /ROOT/content/common/souce/ folder of my store, i for sure know its a query issue, can anyone tell me the right way to do the query for my requirement?