Move from pg_trgm to full-text search for autofill
This commit is contained in:
parent
11743dc983
commit
494ec52afb
@ -6,9 +6,12 @@ const autofillFunctionMap = {
|
|||||||
|
|
||||||
function getLanduseClassOptions(value: string) {
|
function getLanduseClassOptions(value: string) {
|
||||||
return db.manyOrNone(`
|
return db.manyOrNone(`
|
||||||
SELECT landuse_id AS id, description as value, similarity(description, $1) AS similarity
|
SELECT
|
||||||
|
landuse_id AS id,
|
||||||
|
description as value,
|
||||||
|
ts_rank(to_tsvector(description), plainto_tsquery($1)) as similarity
|
||||||
FROM reference_tables.buildings_landuse_class
|
FROM reference_tables.buildings_landuse_class
|
||||||
WHERE description % $1
|
WHERE to_tsvector(description) @@ plainto_tsquery($1)
|
||||||
ORDER BY similarity DESC, description
|
ORDER BY similarity DESC, description
|
||||||
`, [value]
|
`, [value]
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user