cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene search doesn't work in Share

frontman
Champ in-the-making
Champ in-the-making
Hi everybody,

I'm using document library filters to perform a search over a site content. I pass the filter and search parameters through a url (title, description and doctype) and logging the query string that is well-formed in filters.lib.js. The problem is I ain't getting any results when it's suppose I have to. But when I use the same query string in the node browser in Alfresco Explorer I get the results that I have to.

By the way, all the content in the site was migrated.

Is there a problem for the context (share) I'm using to perform the search? or maybe are the problem is about indexes?

Thanks in advanced.
4 REPLIES 4

mikeh
Star Contributor
Star Contributor
Difficult to comment on without seeing some code and sample query please.

Thanks,
Mike

frontman
Champ in-the-making
Champ in-the-making
Here's the code I use to generate the query (filters.lib.js):

case "customQuery":            logger.log("llegando a custom query");      logger.log(filterData);      var filterDoctype = " AND(";      var filterDoctypeCount = 0;            filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\"";            if(filterData.length > 0)            {                 var strData=decodeURI(args.filterData);                  var queryArray=strData.split(":");                 for(var i=0;i < queryArray.length;i++)                 {                    var strQuery=queryArray[i];                    var strQueryArray=strQuery.split("_");                    switch (strQueryArray[0])                    {                       case "ftx":                                          var ftterm=strQueryArray[1];                       var ftquery=" +(";                  var ftterms = ftterm.split(/\s/), x, j, t;                          for (x = 0, j = ftterms.length; x < j; x++)                          {                              t = ftterms[x];                              // remove quotes - TODO: add support for quoted terms later                              t = t.replace(/\"/g, "");                              if (t.length !== 0)                              {                                   switch (t.toLowerCase())                                   {                                      case "y":                                         if (x < j - 1 && ftterms[x + 1].length !== 0)                                         {                                               ftquery += "AND ";                                         }                                      break;                                      case "o":                                                      if (x < j - 1 && ftterms[x + 1].length !== 0)                                         {                                               ftquery += "OR ";                                         }                                      break;                                      case "no":                                         if (x < j - 1 && ftterms[x + 1].length !== 0)                                         {                                              ftquery += "NOT ";                                         }                                      break;                                      default:                                         ftquery += "TEXT:\"" + t + "\"" + " ";                                      break;                                 }                              }                        }                                                filterQuery += ftquery+") ";                     break;                                          case "doctype":                     if(filterDoctypeCount > 0)                     {                        filterDoctype +=" OR "                     }                              filterDoctype+= "TYPE:\"{posadas.model}"+strQueryArray[1]+"\"";                                          filterDoctypeCount++;                     break;                                          case "file":                                                filterQuery += " +(@cm\\:name:"+strQueryArray[1] + " OR @cm\\:name:*"+strQueryArray[1]+"*)" ;                     logger.log("filterQuery:" + filterQuery);                     break;                  case "description":                           filterQuery += " +(@cm\\:description:"+strQueryArray[1] + " OR @cm\\:description:*"+strQueryArray[1]+"*)" ;                     break;                  case "title":                          filterQuery += " +(@cm\\:title:"+strQueryArray[1] + " OR @cm\\:title:*"+strQueryArray[1]+"*)" ;                     break;                                                                                                               case "sort":                          if(strQueryArray[1]=="editdesc")                          {                             filterParams.sort = [                             {                                column: "@{http://www.alfresco.org/model/content/1.0}modified",                                ascending: false                             }];                          }                          if(strQueryArray[1]=="editasc")                          {                             filterParams.sort = [                             {                                   column: "@{http://www.alfresco.org/model/content/1.0}modified",                                ascending: true                             }];                          }                          break;                  }                }          }                 if(filterDoctypeCount > 0)      {              filterDoctype += ") ";              filterQuery += filterDoctype;      }          filterParams.query = filterQuery + filterQueryDefaults;          filterParams.query += " " + (Filters.TYPE_MAP["documents"]);          break;         default:            filterParams.variablePath = false;            filterQuery = "+PATH:\"" + parsedArgs.parentNode.qnamePath + "/*\"";            filterParams.query = filterQuery + filterQueryDefaults;            break;      }   logger.log("filterQuery:"+filterQuery);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

And here's a fragment from the log:

11:42:21,400 User:adminkonexo DEBUG [repo.jscript.ScriptLogger] filterQuery:+PATH:"/app:company_home/st:sites/cm:fiestarewards/cm:documentLibrary/*" +(@cm\:title:acapulco)
11:42:21,601 User:adminkonexo DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 474.61798ms

With this query I'm trying to get all documents with the word "acapulco" on their title, but I ain't gettin anything. But If I copy the same query in the node browser using the lucene search I get the right documents. If I put "*" as a wildcard without completing the word (e.g. "aca*", "*aca*") it works.

The same happens when I search for description or content.

I already tried cleaning the web browser cache, the app server too and re-indexing the content. But It keeps working erratically from share.

Thanks in advanced.

lista
Star Contributor
Star Contributor
Allow me to add a bit to the topic.
It appears the Lucene search won't look under Share spaces by default. For example, if I have a couple of nodes with 'custom' aspect under Share, 'ASPECT: "cm:custom"' won't find them. If I add a PATH part to the query too, specifying to look under Share, it will find them.

Is this kind of behavior intentional, or can I consider this a bug?

flopez
Champ in-the-making
Champ in-the-making
For example, if I have a couple of nodes with 'custom' aspect under Share, 'ASPECT: "cm:custom"' won't find them. If I add a PATH part to the query too, specifying to look under Share, it will find them.

Did you find a solution for this? I'm trying to do this same thing, but search.luceneSearch isn't available in Share, nor the custom aspets are found trough lucene query language Smiley Frustrated