Commit 82cedc2e authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add config and help item for exact user search option

Change-Id: I644491740622d242677c06bb24779e676ad93838
Signed-off-by: default avatarRichard Mansfield <>
parent 0c1f3ec9
<h3>Exact user searches</h3>
<p>If your site has a lot of users and uses a PostgreSQL database,
user searches will be faster with exact user searching enabled.
The setting will still work with MySQL databases, but is unlikely
to significantly increase search performance.</p>
<p>However, partial matches on profile fields will not return results,
so if for example you have a user called "Nigel", then typing "Nige"
into the search box will not find that user.</p>
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <>.
* @package mahara
* @subpackage lang
* @author Catalyst IT Ltd
* @license GNU GPL
* @copyright (C) 2006-2009 Catalyst IT Ltd
defined('INTERNAL') || die();
$string['exactusersearch'] = 'Exact user searches';
$string['exactusersearchdescription'] = 'If checked, results from the Search Users box and Find Friends page are only returned for users whose profile fields match entire search terms.';
......@@ -37,6 +37,34 @@ class PluginSearchInternal extends PluginSearch {
return false;
public static function has_config() {
return true;
public static function get_config_options() {
return array(
'elements' => array(
'exactusersearch' => array(
'title' => get_string('exactusersearch', 'search.internal'),
'description' => get_string('exactusersearchdescription', 'search.internal'),
'help' => true,
'type' => 'checkbox',
'defaultvalue' => get_config_plugin('search', 'internal', 'exactusersearch'),
public function save_config_options($values) {
set_config_plugin('search', 'internal', 'exactusersearch', (int) $values['exactusersearch']);
public static function postinst($prevversion) {
if ($prevversion == 0) {
set_config_plugin('search', 'internal', 'exactusersearch', 1);
* Implement user searching with SQL
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