Skip to content

Commit

Permalink
Merge pull request #2 from betagouv/serach_diacritics
Browse files Browse the repository at this point in the history
Ignore diacritics in search
  • Loading branch information
jillro authored Sep 12, 2024
2 parents cc073fa + f2fabc5 commit b785bc2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/rechercher/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ async function getResults(query: string): Promise<SearchResultItem[]> {
.selectFrom("search_index")
.selectAll()
.select(({ fn, val }) => [
fn("word_similarity", [val(query), "token"]).as("sml"),
fn("word_similarity", [fn("unaccent", [val(query)]), "token"]).as("sml"),
])
.where("token", sql`%>`, query)
.where(sql<boolean>`token %> unaccent(${query})`)
.orderBy("sml", "desc")
.orderBy(({ fn }) => fn("length", ["token"]));

Expand Down

0 comments on commit b785bc2

Please sign in to comment.