Commit f3074785 authored by Nigel McNie's avatar Nigel McNie
Browse files

Improvement on searching algorithm - search on preferredname if available...

Improvement on searching algorithm - search on preferredname if available regardless of public setting
parent cc3e8a78
......@@ -98,7 +98,10 @@ class PluginSearchInternal extends PluginSearch {
WHERE
u.id <> 0 AND u.active = 1
AND ((
u.preferredname IS NULL
u.preferredname ILIKE \'%\' || ? || \'%\'
)
OR (
(u.preferredname IS NULL OR u.preferredname = \'\')
AND (
u.firstname ILIKE \'%\' || ? || \'%\'
OR u.lastname ILIKE \'%\' || ? || \'%\'
......@@ -110,7 +113,7 @@ class PluginSearchInternal extends PluginSearch {
)
)
',
array($query_string, $query_string, $query_string)
array($query_string, $query_string, $query_string, $query_string)
);
if ($count > 0) {
......@@ -122,7 +125,10 @@ class PluginSearchInternal extends PluginSearch {
WHERE
u.id <> 0 AND u.active = 1
AND ((
u.preferredname IS NULL
u.preferredname ILIKE \'%\' || ? || \'%\'
)
OR (
(u.preferredname IS NULL OR u.preferredname = \'\')
AND (
u.firstname ILIKE \'%\' || ? || \'%\'
OR u.lastname ILIKE \'%\' || ? || \'%\'
......@@ -134,7 +140,7 @@ class PluginSearchInternal extends PluginSearch {
)
)
ORDER BY u.firstname, u.lastname, u.id',
array($query_string, $query_string, $query_string),
array($query_string, $query_string, $query_string, $query_string),
$offset,
$limit);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment