Skip to content

Commit

Permalink
[TASK] Make search in file module case-insensitive
Browse files Browse the repository at this point in the history
The JavaScript-Based search in the file module is case sensitive. This
is unusual for searches.

Both the searched value as well as the searchable data are now
transformed toLowerCase before comparison.

Possible improvements are:
 - Applying that transformation in Fluid, trading having it to do every
   request server-side vs. not having to do it on the client for every
   search.
 - Implementing some kind of fuzzy search-logic.
  • Loading branch information
dreistromlandMf authored and pixeldesu committed Sep 25, 2024
1 parent a8c6b6f commit 33242ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Resources/Public/JavaScript/BackendModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ define([
const searchForm = document.querySelector('.js-form-search');
if (searchForm) {
new DebounceEvent('input', function (event) {
const searchValue = event.target.value;
const searchValue = event.target.value.toLowerCase();
const elements = document.querySelectorAll('.in2publish-stagelisting__item');

(Array.from(elements)).forEach(function (item) {
if (searchValue !== '') {
const searchable = item.getAttribute('data-searchable');
const searchable = item.getAttribute('data-searchable').toLowerCase();

if (!searchable.includes(searchValue)) {
item.classList.add('d-none');
Expand Down

0 comments on commit 33242ec

Please sign in to comment.