Merge pull request #3101 from lonvia/custom-geometry-type

Improve use of SQLAlchemy statement cache with search queries
This commit is contained in:
Sarah Hoffmann
2023-07-03 11:03:26 +02:00
committed by GitHub
22 changed files with 415 additions and 251 deletions

View File

@@ -284,3 +284,26 @@ BEGIN
END;
$$
LANGUAGE plpgsql IMMUTABLE;
CREATE OR REPLACE FUNCTION weigh_search(search_vector INT[],
term_vectors TEXT[],
weight_vectors FLOAT[],
def_weight FLOAT)
RETURNS FLOAT
AS $$
DECLARE
pos INT := 1;
terms TEXT;
BEGIN
FOREACH terms IN ARRAY term_vectors
LOOP
IF search_vector @> terms::INTEGER[] THEN
RETURN weight_vectors[pos];
END IF;
pos := pos + 1;
END LOOP;
RETURN def_weight;
END;
$$
LANGUAGE plpgsql IMMUTABLE;