Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-complétion - Amélioration de la recherche - bug accent #1

Open
pierre56 opened this issue Oct 5, 2023 · 4 comments
Open

Auto-complétion - Amélioration de la recherche - bug accent #1

pierre56 opened this issue Oct 5, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@pierre56
Copy link

pierre56 commented Oct 5, 2023

Version
Version de GeoNature 2.13.0

Description du bug
module pop reptile et amphibien
Non affichage des noms verns des espèces lorsqu'il y a un accent

Comportement attendue
affichage du vern avec accent
exemple pour pop
crapaud épineux ou triton alpestre

@pierre56 pierre56 added the bug Something isn't working label Oct 5, 2023
@pierre56
Copy link
Author

pierre56 commented Oct 6, 2023

Debug

Liste OHB POP Reptile

https://taxhub.bretagne-vivante.org/#!/listes/101

Export de la liste

export_OHB_POP_Reptile.csv

il manque 2 noms verns

image
Alors que la liste taxhub est complète

image

URL

GET | https://taxhub.bretagne-vivante.org/api/taxref/allnamebylist/101?search_name=léz&limit=20

image

image

DB

Cor_nom_liste

image

bib_noms

image

vm_taxref_list_forautocomplete

image

REFRESH MATERIALIZED VIEW taxonomie.vm_taxref_list_forautocomplete WITH DATA;

Toujours vide après refresh

-> Le problème m'a l'air de venir de la requete

je vais voir si ça me retourne mieux avec jointure

@pierre56
Copy link
Author

pierre56 commented Oct 6, 2023

taxonomie.vm_taxref_list_forautocomplete

Originale

CREATE MATERIALIZED VIEW taxonomie.vm_taxref_list_forautocomplete
TABLESPACE pg_default
AS SELECT row_number() OVER () AS gid,
    t.cd_nom,
    t.cd_ref,
    t.search_name,
    unaccent(t.search_name) AS unaccent_search_name,
    t.nom_valide,
    t.lb_nom,
    t.nom_vern,
    t.regne,
    t.group2_inpn
   FROM ( SELECT t_1.cd_nom,
            t_1.cd_ref,
            concat(t_1.lb_nom, ' = <i>', t_1.nom_valide, '</i>', ' - [', t_1.id_rang, ' - ', t_1.cd_nom, ']') AS search_name,
            t_1.nom_valide,
            t_1.lb_nom,
            t_1.nom_vern,
            t_1.regne,
            t_1.group2_inpn
           FROM taxonomie.taxref t_1
        UNION
         SELECT DISTINCT t_1.cd_nom,
            t_1.cd_ref,
            concat(split_part(t_1.nom_vern::text, ','::text, 1), ' = <i>', t_1.nom_valide, '</i>', ' - [', t_1.id_rang, ' - ', t_1.cd_ref, ']') AS search_name,
            t_1.nom_valide,
            t_1.lb_nom,
            t_1.nom_vern,
            t_1.regne,
            t_1.group2_inpn
           FROM taxonomie.taxref t_1
          WHERE t_1.nom_vern IS NOT NULL AND t_1.cd_nom = t_1.cd_ref) t
WITH DATA;

-- View indexes:
CREATE INDEX i_tri_vm_taxref_list_forautocomplete_search_name ON taxonomie.vm_taxref_list_forautocomplete USING gin (unaccent_search_name gin_trgm_ops);
CREATE INDEX i_vm_taxref_list_forautocomplete_cd_nom ON taxonomie.vm_taxref_list_forautocomplete USING btree (cd_nom);
CREATE UNIQUE INDEX i_vm_taxref_list_forautocomplete_gid ON taxonomie.vm_taxref_list_forautocomplete USING btree (gid);

Join bib_noms

exemple cd_nom = 77619

drop MATERIALIZED VIEW taxonomie.vm_taxref_list_forautocomplete

CREATE MATERIALIZED VIEW taxonomie.vm_taxref_list_forautocomplete
TABLESPACE pg_default
AS SELECT row_number() OVER () AS gid,
    t.cd_nom,
    t.cd_ref,
    t.search_name,
    unaccent(t.search_name) AS unaccent_search_name,
    t.nom_valide,
    t.lb_nom,
    coalesce (bn.nom_francais , t.nom_vern) as nom_vern,
    t.regne,
    t.group2_inpn
   FROM ( SELECT t_1.cd_nom,
            t_1.cd_ref,
            concat(t_1.lb_nom, ' = <i>', t_1.nom_valide, '</i>', ' - [', t_1.id_rang, ' - ', t_1.cd_nom, ']') AS search_name,
            t_1.nom_valide,
            t_1.lb_nom,
            t_1.nom_vern,
            t_1.regne,
            t_1.group2_inpn
           FROM taxonomie.taxref t_1
        UNION
         SELECT DISTINCT t_1.cd_nom,
            t_1.cd_ref,
            concat(split_part(t_1.nom_vern::text, ','::text, 1), ' = <i>', t_1.nom_valide, '</i>', ' - [', t_1.id_rang, ' - ', t_1.cd_ref, ']') AS search_name,
            t_1.nom_valide,
            t_1.lb_nom,
            t_1.nom_vern,
            t_1.regne,
            t_1.group2_inpn
           FROM taxonomie.taxref t_1
          WHERE t_1.nom_vern IS NOT NULL AND t_1.cd_nom = t_1.cd_ref) t
    join taxonomie.bib_noms bn on bn.cd_nom = t.cd_nom
          
WITH DATA;

-- View indexes:
CREATE INDEX i_tri_vm_taxref_list_forautocomplete_search_name ON taxonomie.vm_taxref_list_forautocomplete USING gin (unaccent_search_name gin_trgm_ops);
CREATE INDEX i_vm_taxref_list_forautocomplete_cd_nom ON taxonomie.vm_taxref_list_forautocomplete USING btree (cd_nom);
CREATE UNIQUE INDEX i_vm_taxref_list_forautocomplete_gid ON taxonomie.vm_taxref_list_forautocomplete USING btree (gid);

@pierre56
Copy link
Author

pierre56 commented Oct 6, 2023

Ne résout pas le pb car cela tape sur le champs search_name

2eme modif


drop MATERIALIZED VIEW taxonomie.vm_taxref_list_forautocomplete

CREATE MATERIALIZED VIEW taxonomie.vm_taxref_list_forautocomplete
TABLESPACE pg_default
AS SELECT row_number() OVER () AS gid,
    t.cd_nom,
    t.cd_ref,
    t.search_name,
    unaccent(t.search_name) AS unaccent_search_name,
    t.nom_valide,
    t.lb_nom,
    t.nom_vern,
    t.regne,
    t.group2_inpn
   FROM ( SELECT t_1.cd_nom,
            t_1.cd_ref,
            concat(t_1.lb_nom, ' = <i>', t_1.nom_valide, '</i>', ' - [', t_1.id_rang, ' - ', t_1.cd_nom, ']') AS search_name,
            t_1.nom_valide,
            t_1.lb_nom,
            t_1.nom_vern,
            t_1.regne,
            t_1.group2_inpn
           FROM taxonomie.taxref t_1
        UNION
         SELECT DISTINCT t_1.cd_nom,
            t_1.cd_ref,
            concat(split_part(coalesce (bn.nom_francais , t_1.nom_vern)::text, ','::text, 1), ' = <i>', t_1.nom_valide, '</i>', ' - [', t_1.id_rang, ' - ', t_1.cd_ref, ']') AS search_name,
            t_1.nom_valide,
            t_1.lb_nom,
            t_1.nom_vern,
            t_1.regne,
            t_1.group2_inpn
           FROM taxonomie.taxref t_1
           join taxonomie.bib_noms bn on bn.cd_nom = t_1.cd_nom
          WHERE coalesce (bn.nom_francais , t_1.nom_vern)::text IS NOT NULL AND t_1.cd_nom = t_1.cd_ref) t
    
          
WITH DATA;

-- View indexes:
CREATE INDEX i_tri_vm_taxref_list_forautocomplete_search_name ON taxonomie.vm_taxref_list_forautocomplete USING gin (unaccent_search_name gin_trgm_ops);
CREATE INDEX i_vm_taxref_list_forautocomplete_cd_nom ON taxonomie.vm_taxref_list_forautocomplete USING btree (cd_nom);
CREATE UNIQUE INDEX i_vm_taxref_list_forautocomplete_gid ON taxonomie.vm_taxref_list_forautocomplete USING btree (gid);

grant all privileges on taxonomie.vm_taxref_list_forautocomplete to geonatadmin ;

Victoire c'est fonctionnel \o/

image

@pierre56
Copy link
Author

pierre56 commented Oct 6, 2023

Presque

Après vérif l'export contient toujours les trous.

image

Il va falloir que je corrige ça, mais le besoin immédiat est résolu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant