05-07-2010 01:33 AM
05-07-2010 04:29 AM
05-12-2010 01:36 PM
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);
07-19-2010 09:37 AM
04-04-2011 03:29 PM
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.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.