Skip to content

Commit

Permalink
fix(synthese) adding unnaccent to search_name
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Narcisi authored and TheoLechemia committed Sep 7, 2023
1 parent eb4d067 commit 2af6a8b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/geonature/core/gn_synthese/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,15 +796,18 @@ def get_autocomplete_taxons_synthese():
.join(Synthese, Synthese.cd_nom == VMTaxrefListForautocomplete.cd_nom)
)
search_name = search_name.replace(" ", "%")
q = q.filter(VMTaxrefListForautocomplete.unaccent_search_name.ilike("%" + search_name + "%"))
q = q.filter(
VMTaxrefListForautocomplete.unaccent_search_name.ilike(
func.unaccent("%" + search_name + "%")
)
)
regne = request.args.get("regne")
if regne:
q = q.filter(VMTaxrefListForautocomplete.regne == regne)

group2_inpn = request.args.get("group2_inpn")
if group2_inpn:
q = q.filter(VMTaxrefListForautocomplete.group2_inpn == group2_inpn)

q = q.order_by(desc(VMTaxrefListForautocomplete.cd_nom == VMTaxrefListForautocomplete.cd_ref))
limit = request.args.get("limit", 20)
data = q.order_by(desc("idx_trgm")).limit(20).all()
Expand Down

0 comments on commit 2af6a8b

Please sign in to comment.