Forums | Mahara Community

Support /
Case-insensitive search


Florian Kurrle's profile picture
Posts: 12

06 September 2018, 8:48 PM

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?

Kristina Hoeppner's profile picture
Posts: 3780

13 September 2018, 3:14 PM

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

 

Florian Kurrle's profile picture
Posts: 12

14 September 2018, 2:58 AM

Hi Kristina,

I mean this page: /view/sharedviews.php I can search there for portfolios which I am allowed to see.

Florian

Robert Lyon's profile picture
Posts: 490

14 September 2018, 8:31 AM

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

4 results