Added requestor field to search

This commit is contained in:
Daniel J. Summers 2019-03-16 09:15:50 -05:00
parent 8b46a670fa
commit 215325f6fb
2 changed files with 8 additions and 2 deletions

View File

@ -118,7 +118,11 @@ type AppDbContext with
member this.SearchRequestsForSmallGroup (grp : SmallGroup) (searchTerm : string) pageNbr : PrayerRequest seq = member this.SearchRequestsForSmallGroup (grp : SmallGroup) (searchTerm : string) pageNbr : PrayerRequest seq =
let pgSz = grp.preferences.pageSize let pgSz = grp.preferences.pageSize
let skip = (pageNbr - 1) * pgSz let skip = (pageNbr - 1) * pgSz
let sql = RawSqlString """SELECT * FROM pt."PrayerRequest" WHERE "SmallGroupId" = {0} AND "Text" ILIKE {1}""" let sql =
""" SELECT * FROM pt."PrayerRequest" WHERE "SmallGroupId" = {0} AND "Text" ILIKE {1}
UNION
SELECT * FROM pt."PrayerRequest" WHERE "SmallGroupId" = {0} AND COALESCE("Requestor", '') ILIKE {1}"""
|> RawSqlString
let like = sprintf "%%%s%%" let like = sprintf "%%%s%%"
upcast ( upcast (
this.PrayerRequests.FromSql(sql, grp.smallGroupId, like searchTerm).AsNoTracking () this.PrayerRequests.FromSql(sql, grp.smallGroupId, like searchTerm).AsNoTracking ()

View File

@ -1,3 +1,5 @@
create extension pg_trgm; create extension pg_trgm;
set search_path=pt,public;
create index "IX_PrayerRequest_Requestor_TRGM" on "PrayerRequest" using GIN (COALESCE("Requestor", '') gin_trgm_ops);
create index "IX_PrayerRequest_Text_TRGM" on "PrayerRequest" using GIN ("Text" gin_trgm_ops); create index "IX_PrayerRequest_Text_TRGM" on "PrayerRequest" using GIN ("Text" gin_trgm_ops);
alter table "ListPreference" add column "PageSize" int not null default 100; alter table "ListPreference" add column "PageSize" int not null default 100;