Commit 0ce9e16d authored by Emmanuel Raviart's avatar Emmanuel Raviart
Browse files

Ensure that "dossier" is unique in list.

parent b1d5bdd6
......@@ -103,8 +103,11 @@ export const listDossiers = wrapAsyncMiddleware(async function listDossiers(
whereClauses.push("(date_dernier_acte >= $<date> OR date_prochain_acte NOTNULL)")
}
if (term !== null) {
joinClauses.push("INNER JOIN dossiers_text_search ON dossiers.uid = dossiers_text_search.uid")
whereClauses.push("text_search @@ plainto_tsquery('french', $<term>)")
whereClauses.push(`uid IN (
SELECT uid
FROM dossiers_text_search
WHERE text_search @@ plainto_tsquery('french', $<term>)
)`)
}
const joinsClause = joinClauses.length > 0 ? joinClauses.join(" ") : ""
const whereClause = whereClauses.length > 0 ? "WHERE " + whereClauses.join(" AND ") : ""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment