|
@@ -84,13 +84,21 @@ INSERT INTO lu_entities_history ("table", "data") VALUES(TG_TABLE_NAME, to_json(
|
84
|
84
|
return NEW;
|
85
|
85
|
END$$;
|
86
|
86
|
|
|
87
|
+--
|
|
88
|
+-- Name: lu_text_match_prepare(text); Type: FUNCTION; Schema: public; Owner: dev
|
|
89
|
+--
|
|
90
|
+
|
|
91
|
+CREATE FUNCTION lu_text_match_prepare(data text) RETURNS text
|
|
92
|
+ LANGUAGE sql
|
|
93
|
+ AS $$SELECT regexp_replace(unaccent(data), '[^a-zA-Z0-9]+', ' ', 'g')$$;
|
|
94
|
+
|
87
|
95
|
--
|
88
|
96
|
-- Name: lu_text_match(text, text); Type: FUNCTION; Schema: public;
|
89
|
97
|
--
|
90
|
98
|
|
91
|
99
|
CREATE FUNCTION lu_text_match(query text, data text) RETURNS boolean
|
92
|
100
|
LANGUAGE sql
|
93
|
|
- AS $$SELECT unaccent(data) ILIKE ('%' || unaccent(query) || '%') AS result$$;
|
|
101
|
+ AS $$SELECT lu_text_match_prepare(data) ILIKE ('%' || lu_text_match_prepare(query) || '%') AS result$$;
|
94
|
102
|
|
95
|
103
|
--
|
96
|
104
|
-- Name: lu_texts_match(text, text[]); Type: FUNCTION; Schema: public;
|