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());
}
}