Skip to content

Text filter/search should be case insensitive

Search text used for searching/filtering results should be case insensitive.

Example:

image

image

(Same for notifications, but will be included in the ongoing MR: https://gitlab.cern.ch/push-notifications/backend/-/merge_requests/201)

It is currently being done like so:

searchTextQB.where(
        'channel.description Like :searchText or channel.name Like :searchText or owner.username Like :searchText',
        { searchText: `%${searchText}%` },
      );

Case insensitivity can be done some different ways suggested:

.where("LOWER(title) LIKE :title", { title: `%${ title.toLowerCase() }%` })

or using the ILIKE operator that is unclear if is implemented already:

where: {
    name: Raw(alias => `${alias} ILIKE '%${name}%'`),
  },

WARNING: this could not be SQLi safe.

Or even:

Entity.find({
    where: `"column" ILIKE 'keyword'` 
});