Search plugin – is it possible to search case insensitive?

    • Andrea Milano
      Participant
      # 1 year, 5 months ago

      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 Milano
      Participant
      # 1 year, 5 months ago

      My bad to not being more specific: I meant case insensitive through filename

    • Andrea Milano
      Participant
      # 1 year, 5 months ago

      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 Milano
      Participant
      # 1 year, 5 months ago

      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

    • # 1 year, 5 months ago

      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 Milano
        Participant
        # 1 year, 5 months ago

        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.

Viewing 4 reply threads

The topic ‘Search plugin – is it possible to search case insensitive?’ is closed to new replies.