From 144cae5c384f9a899cfd9979b1b7d45b4088a692 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Tue, 11 Feb 2014 19:28:38 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud) 57092: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3) 56577: Merged V4.1-BUG-FIX (4.1.7) to V4.2-BUG-FIX (4.2.1) 56483: MNT-9629: Merged V4.1.5 (4.1.5.9) to V4.1-BUG-FIX (4.1.7) 56479: MNT-9719 CLONE - User search does not return results with " " search in admin console users page. - Addition of an Alfresco global property people.search.honor.hint.useCQ, which may be set to false to switch back to just using Solr or Lucene as it was in 4.1.1 rather than the canned query used by the Share User Console git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61721 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/repository.properties | 4 ++++ config/alfresco/script-services-context.xml | 3 +++ .../org/alfresco/repo/jscript/People.java | 20 ++++++++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/config/alfresco/repository.properties b/config/alfresco/repository.properties index 787191fc1a..83a512d3a7 100644 --- a/config/alfresco/repository.properties +++ b/config/alfresco/repository.properties @@ -1078,3 +1078,7 @@ system.patch.sharedFolder.deferred=false # Default value is run new years day 2030 i.e. not run. system.patch.sharedFolder.cronExpression=0 0 0 ? 1 1 2030 +# +# Use a canned query when requested to search for people if " [hint:useCQ]" is provided in search term +# +people.search.honor.hint.useCQ=true \ No newline at end of file diff --git a/config/alfresco/script-services-context.xml b/config/alfresco/script-services-context.xml index bc414e6d21..e2dd88f352 100644 --- a/config/alfresco/script-services-context.xml +++ b/config/alfresco/script-services-context.xml @@ -162,6 +162,9 @@ + + ${people.search.honor.hint.useCQ} + diff --git a/source/java/org/alfresco/repo/jscript/People.java b/source/java/org/alfresco/repo/jscript/People.java index e66b7ed3c3..d7cae23d2e 100644 --- a/source/java/org/alfresco/repo/jscript/People.java +++ b/source/java/org/alfresco/repo/jscript/People.java @@ -94,6 +94,7 @@ public class People extends BaseScopableProcessorExtension implements Initializi private int numRetries = 10; private int defaultListMaxResults = 5000; + private boolean honorHintUseCQ = true; private static final String HINT_CQ_SUFFIX = " [hint:useCQ]"; @@ -243,6 +244,23 @@ public class People extends BaseScopableProcessorExtension implements Initializi this.defaultListMaxResults = defaultListMaxResults; } + /** + * Allows customers to choose to use Solr or Lucene rather than a canned query in + * {@link #getPeople(String, int, String, boolean)} when + * {@code " [hint:useCQ]"} is appended to the search term (currently Share's + * User Console does this). The down side is that new users may not appear as they + * will not have been indexed. This is similar to what happened in 4.1.1 prior to + * MNT-7548 (4.1.2 and 4.1.1.1). The down side of using a canned query at the moment + * is that there is a bug, so that it is impossible to search for names such as + * {@code "Carlos Allende GarcĂ­a"} where the first or last names may contain spaces. + * See MNT-9719 for more details. The alfresco global property + * {@code people.search.honor.hint.useCQ} is used to set this value (default is true). + */ + public void setHonorHintUseCQ(boolean honorHintUseCQ) + { + this.honorHintUseCQ = honorHintUseCQ; + } + /** * Delete a Person with the given username * @@ -563,7 +581,7 @@ public class People extends BaseScopableProcessorExtension implements Initializi { if (filter.endsWith(HINT_CQ_SUFFIX)) { - useCQ = true; + useCQ = honorHintUseCQ; filter = filter.substring(0, filter.length()-HINT_CQ_SUFFIX.length()); } }