Search plugin – is it possible to search case insensitive?
-
-
Andrea MilanoParticipant# il y a 2 années et 1 mois
Good afternoon,
forgive me there is already a reply, english isn’t my mother tongue. I’m using the WP Customer Area – Search plugin, as you can see from the attached image:
In the orange frame you can see the superlongname file containing ODIGIE.
In the blue frame if I input odigie the plugin can’t match anything.
In the green frame if I input ODIGIE the plugin can correctly find the file.As far as I understand the results are case sensitive. There is a way to make it work as case insensitive? Because I’m sure, clients will drive me crazy about this.
Thanks in advance
-
Andrea MilanoParticipant# il y a 2 années et 1 mois
My bad to not being more specific: I meant case insensitive through filename
-
Andrea MilanoParticipant# il y a 2 années et 1 mois
Good morning,
forgive me if there is already a reply, english isn’t my mother tongue and can’t find it.
I bought the WP Customer Area – Search plugin, while testing it I found that is case sensitive for filenames.As you can see from the attached image:
In the orange frame you can see the superlongname file containing ODIGIE.
In the blue frame if I input odigie the plugin can’t match anything.
In the green frame if I input ODIGIE the plugin can correctly find the file.As far as I understand the results regarding files are case sensitive. There is a way to make it work as case insensitive? If I am doing something wrong would you point me to the solution?
Thanks in advance
-
Andrea MilanoParticipant# il y a 2 années et 1 mois
Hi,
forgive me if there is already a reply, my limited intellectual abilities can’t let me find it.I bought the WP Customer Area – Search plugin, while testing it I found that is case sensitive for filenames.
As you can see from the attached image:
In the orange frame you can see the superlongname file containing ODIGIE.
In the blue frame if I input odigie the plugin can’t match anything.
In the green frame if I input ODIGIE the plugin can correctly find the file.As far as I understand the results regarding files are case sensitive. There is a way to make it work as case insensitive? If I am doing something wrong would you point me to the solution?
Thanks in advance
-
Vincent Mimoun-PratMaître des clés# il y a 2 années et 1 mois
Hi,
Until we make a new release, you could change the file
src/php/search-addon.class.php
like that to allow case-insensitive search:- Lines 113-144, add one line in between
$result = [];
$ciCriteria = strtolower($criteria['query']);
foreach ($posts->posts as $post)
- Lines 119-120, update them like that:
if (strpos(strtolower($file['file']), $ciCriteria) === false
&& strpos(strtolower($file['caption']), $ciCriteria) === false)
That should do what you want.-
Andrea MilanoParticipant# il y a 2 années et 1 mois
It works smoothly. Thanks indeed.
Just a note for your next release, would be nice if multiple keywords could be used in the search form.
Have a nice day,
A.M.
-
The topic ‘Search plugin – is it possible to search case insensitive?’ is closed to new replies.