search without accent
This commit is contained in:
parent
8c17dd6e1d
commit
06a71cdf85
2 changed files with 5 additions and 2 deletions
|
@ -27,8 +27,8 @@ class DossierSearchService
|
|||
end
|
||||
|
||||
def self.dossier_by_full_text(dossiers, search_terms, with_annotations)
|
||||
ts_vector = "to_tsvector('french', #{with_annotations ? 'dossiers.search_terms || dossiers.private_search_terms' : 'dossiers.search_terms'})"
|
||||
ts_query = "to_tsquery('french', #{Dossier.connection.quote(to_tsquery(search_terms))})"
|
||||
ts_vector = "to_tsvector('french', unaccent(#{with_annotations ? 'dossiers.search_terms || dossiers.private_search_terms' : 'dossiers.search_terms'}))"
|
||||
ts_query = "to_tsquery('french', unaccent(#{Dossier.connection.quote(to_tsquery(search_terms))}))"
|
||||
|
||||
dossiers
|
||||
.visible_by_administration
|
||||
|
|
|
@ -58,6 +58,9 @@ describe DossierSearchService do
|
|||
|
||||
# by singular
|
||||
expect(searching('la pomme')).to eq([dossier.id])
|
||||
|
||||
# without accent
|
||||
expect(searching('helene')).to eq([dossier.id])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue