fix and spec for annotations search

This commit is contained in:
simon lehericey 2024-12-04 19:02:53 +01:00
parent c6c82579b8
commit cf705813da
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
2 changed files with 22 additions and 5 deletions

View file

@ -37,7 +37,7 @@ class DossierSearchService
end
def self.dossier_by_full_text(dossiers, search_terms, with_annotations: false)
columns = with_annotations ? 'search_terms || private_search_terms' : 'search_terms'
columns = with_annotations ? 'search_terms || \' \' || private_search_terms' : 'search_terms'
ts_vector = "to_tsvector('french', unaccent(#{columns}))"
ts_query = "to_tsquery('french', unaccent(#{Dossier.connection.quote(to_tsquery(search_terms))}))"