AnsweredAssumed Answered

Advanced search in dashlet using Document Library page

Question asked by frontman on Apr 25, 2010
Latest reply on May 6, 2010 by frontman
Hi everyone…

What I'm trying to accomplish is getting an advanced search in a dashlet. Looking in the web, I found this:

Like you see, the solution is really simple: create a form with the fields you need, concat the values from those fields and get a url like this: /documentlibrary?filter=customQuery&filterData=file_whitepaper|doctype_contract. I was on 3.2 version and everything worked fine, but we migrated to 3.2r  and it doesn't work anymore.

I've doing some logging in doclist.get.js, filters.lib.js and parse-args.lib.js, which are the ones involved in processing the url.

case "category":
            // Remove any trailing "/" character
            if (filterData.charAt(filterData.length - 1) == "/")
               filterData = filterData.slice(0, -1);
            filterParams.query = "+PATH:\"/cm:generalclassifiable" + Filters.iso9075EncodePath(filterData) + "/member\"";

      //Código para la búsqueda avanzada en Share
         case "customQuery":
      var filterDoctype = " AND(";
      var filterDoctypeCount = 0;

   logger.log("Custom query");

            filterQuery = "+PATH:\"" + parsedArgs.rootNode.qnamePath + "//*\"";

   logger.log("args.fliterData length: " +args.filterData.length);
            if(args.filterData.length > 0)
                 var strData=decodeURI(args.filterData);
                 logger.log("cadena de busqueda:" + strData);
                 var queryArray=strData.split("|");
         logger.log("longitud arreglo:" + queryArray.length);
                 for(var i=0;i < queryArray.length;i++)
                    var strQuery=queryArray[i];
                    var strQueryArray=strQuery.split("_");
                    logger.log("elemento 0:" + strQueryArray[0]);
                    logger.log("elemento 1:"  + strQueryArray[1]);
                    switch (strQueryArray[0])

In filters.lib.js, in the switch part, it gets to "customQuery", but when it comes to if(args.filterData.length > 0), throws this exception: Cannot read property "length" from null.

Like I said, this was working on 3.2 and args.filterData contains the parameters that I put into the url but in 3.2r is alway null. The only difference I realized is the way document library page is called to show other option like "all", "editingMe", "editingOthers", etc.. Instead of /documentlibrary?filter is /documentlibrary#filter…what make me think that maybe I'm sending a malformed url and that's why I'm getting always null.

I really need help with this…thanks in advanced.