Fixed owner searching.

This commit is contained in:
Patrick Fic
2020-02-19 14:39:49 -08:00
parent f49f460a66
commit 2efbd48275
12 changed files with 46 additions and 13 deletions

View File

@@ -0,0 +1,10 @@
- args:
sql: "CREATE OR REPLACE FUNCTION public.search_owners(search text)\n RETURNS SETOF
owners\n LANGUAGE sql\n STABLE\nAS $function$\r\n SELECT *\r\n FROM owners\r\n
\ WHERE\r\n search <% (ownr_fn || ' ' || ownr_ln || ' ' || ownr_addr1
\ || ' ' || ownr_city || ' ' || ownr_zip || ' ' || ownr_ea || ' ' || ownr_ph1
|| ' ' || ownr_ph2)\r\n ORDER BY\r\n similarity(search, (ownr_fn ||
' ' || ownr_ln || ' ' || ownr_addr1 || ' ' || ownr_city || ' ' || ownr_zip
\ || ' ' || ownr_ea || ' ' || ownr_ph1 || ' ' || ownr_ph2)) DESC\r\n LIMIT
20;\r\n$function$\n"
type: run_sql

View File

@@ -0,0 +1,3 @@
- args:
sql: DROP FUNCTION "public"."search_owners"("pg_catalog"."text")
type: run_sql

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,5 @@
- args:
cascade: true
sql: |
drop index owner_gin_idx
type: run_sql

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,5 @@
- args:
cascade: true
sql: "CREATE INDEX idx_owner_name ON owners\r\nUSING GIN ((ownr_fn || ' ' || ownr_ln)
gin_trgm_ops);"
type: run_sql

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,11 @@
- args:
cascade: true
sql: "CREATE FUNCTION search_owner(search text)\r\nRETURNS SETOF owners AS $$\r\n
\ SELECT *\r\n FROM owners\r\n WHERE\r\n search <% (ownr_fn ||
' ' || ownr_ln)\r\n ORDER BY\r\n similarity(search, (ownr_fn || ' '
|| ownr_ln)) DESC\r\n LIMIT 5;\r\n$$ LANGUAGE sql STABLE;"
type: run_sql
- args:
name: search_owner
schema: public
type: track_function