Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

66625: Merged WAT2 (4.3/Cloud) to HEAD-BUG-FIX (4.3/Cloud)
      64718: Merge of Live Search revs 59081-60158 from BRANCHES/DEV/KEVINR - pt1


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@66706 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Will Abson
2014-04-03 16:21:32 +00:00
parent 5c92259c05
commit 1ba34f2b11

View File

@@ -39,6 +39,7 @@ import org.alfresco.service.cmr.search.LimitBy;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.ResultSetRow;
import org.alfresco.service.cmr.search.SearchParameters;
import org.alfresco.service.cmr.search.SearchParameters.Operator;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.security.PermissionService;
@@ -499,6 +500,7 @@ public class Search extends BaseScopableProcessorExtension
* page: object, optional, paging information object (see below) - if supported by the language
* namespace: string, optional, the default namespace for properties
* defaultField: string, optional, the default field for query elements when not explicit in the query
* defaultOperator: string,optional, the default operator for query elements when they are not explicit in the query AND or OR
* onerror: string optional, result on error - one of: exception, no-results - defaults to 'exception'
* }
*
@@ -557,6 +559,7 @@ public class Search extends BaseScopableProcessorExtension
String namespace = (String)def.get("namespace");
String onerror = (String)def.get("onerror");
String defaultField = (String)def.get("defaultField");
String defaultOperator = (String)def.get("defaultOperator");
// extract supplied values
@@ -642,6 +645,10 @@ public class Search extends BaseScopableProcessorExtension
{
sp.setDefaultFieldName(defaultField);
}
if (defaultOperator != null)
{
sp.setDefaultOperator(Operator.valueOf(defaultOperator.toUpperCase()));
}
if (namespace != null)
{
sp.setNamespace(namespace);
@@ -799,8 +806,12 @@ public class Search extends BaseScopableProcessorExtension
{
Collection<ScriptNode> set = null;
long time = 0L;
if (logger.isDebugEnabled())
{
logger.debug("query=" + sp.getQuery() + " limit=" + (sp.getLimitBy() != LimitBy.UNLIMITED ? sp.getLimit() : "none"));
time = System.currentTimeMillis();
}
// perform the search against the repo
ResultSet results = null;
@@ -839,6 +850,8 @@ public class Search extends BaseScopableProcessorExtension
{
results.close();
}
if (logger.isDebugEnabled())
logger.debug("query time: " + (System.currentTimeMillis()-time) + "ms");
}
return set != null ? set.toArray(new Object[(set.size())]) : new Object[0];