Forums | Mahara Community
Support
/
Case-insensitive search
06 September 2018, 20:48
Hi all,
We have a search for portfolios in Mahara. It is the default search.
How can we change the setting into case-insensitive search?
13 September 2018, 15:14
Hello Florian,
Do you mean the "Search users" field in the top right-hand corner or the "Portfolio search" that you can turn on in Configure site -> Site options -> General settings? If it's the latter, that feature is not fully functioning but we haven't gotten around to removing it yet. Mahara supports fulltext search (case insensitive) via Elasticsearch.
Cheers
Kristina
14 September 2018, 2:58
Hi Kristina,
I mean this page: /view/sharedviews.php I can search there for portfolios which I am allowed to see.
Florian
14 September 2018, 8:31
Hmm, that search should already be case insensitive, eg I can search for the work 'Page' and get results for pages titled 'Page', 'page', 'PAGE', 'pAge' etc
Are you meaning making it case sensitive, eg search for 'Page' and only get results for 'Page' ?
To change the sensitivity of the search you can change the following line in
https://git.mahara.org/mahara/mahara/blob/master/htdocs/lib/view.php#L4678
$like = db_ilike();
to
$like = is_mysql() ? 'LIKE BINARY' : 'LIKE';
Note: a bunch of searches use the view_search() function and this change will affect all of them
If you are wanting to change all the searches/places where db_ilike() is used then make the change in the function itself in
https://git.mahara.org/mahara/mahara/blob/master/htdocs/lib/dml.php#L1757
Cheers
Robert