Merge branch '368-fix-user-search-engine' into 'master'

Fix search query for user-groups

Closes #368

See merge request Chill-Projet/chill-bundles!806
This commit is contained in:
Julien Fastré 2025-03-14 14:10:53 +00:00
commit 2840c06476
3 changed files with 14 additions and 12 deletions

View File

@ -0,0 +1,6 @@
kind: Fixed
body: fix search query for user groups
time: 2025-03-14T15:04:08.622666838+01:00
custom:
Issue: "368"
SchemaChange: No schema change

View File

@ -75,8 +75,8 @@ final class UserGroupRepository implements UserGroupRepositoryInterface, LocaleA
->setWhereClauses(' ->setWhereClauses('
ug.active AND ( ug.active AND (
SIMILARITY(LOWER(UNACCENT(?)), ug.label->>?) > 0.15 SIMILARITY(LOWER(UNACCENT(?)), ug.label->>?) > 0.15
OR ug.label->>? LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\') OR LOWER(UNACCENT(ug.label->>?)) LIKE \'%\' || LOWER(UNACCENT(?)) || \'%\')
', [$pattern, $lang, $pattern, $lang]); ', [$pattern, $lang, $lang, $pattern]);
return $query; return $query;
} }

View File

@ -12,10 +12,6 @@ function loadDynamicPicker(element) {
let apps = element.querySelectorAll('[data-module="pick-dynamic"]'); let apps = element.querySelectorAll('[data-module="pick-dynamic"]');
apps.forEach(function (el) { apps.forEach(function (el) {
let suggested;
let as_id;
let submit_on_adding_new_entity;
let label;
const isMultiple = parseInt(el.dataset.multiple) === 1, const isMultiple = parseInt(el.dataset.multiple) === 1,
uniqId = el.dataset.uniqid, uniqId = el.dataset.uniqid,
input = element.querySelector( input = element.querySelector(
@ -26,11 +22,11 @@ function loadDynamicPicker(element) {
? JSON.parse(input.value) ? JSON.parse(input.value)
: input.value === "[]" || input.value === "" : input.value === "[]" || input.value === ""
? null ? null
: [JSON.parse(input.value)]; : [JSON.parse(input.value)],
suggested = JSON.parse(el.dataset.suggested); suggested = JSON.parse(el.dataset.suggested),
as_id = parseInt(el.dataset.asId) === 1; as_id = parseInt(el.dataset.asId) === 1,
submit_on_adding_new_entity = submit_on_adding_new_entity =
parseInt(el.dataset.submitOnAddingNewEntity) === 1; parseInt(el.dataset.submitOnAddingNewEntity) === 1,
label = el.dataset.label; label = el.dataset.label;
if (!isMultiple) { if (!isMultiple) {