Search, Paging, and "As of" Date #10
|
@ -118,7 +118,11 @@ type AppDbContext with
|
|||
member this.SearchRequestsForSmallGroup (grp : SmallGroup) (searchTerm : string) pageNbr : PrayerRequest seq =
|
||||
let pgSz = grp.preferences.pageSize
|
||||
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%%"
|
||||
upcast (
|
||||
this.PrayerRequests.FromSql(sql, grp.smallGroupId, like searchTerm).AsNoTracking ()
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
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);
|
||||
alter table "ListPreference" add column "PageSize" int not null default 100;
|
||||
alter table "ListPreference" add column "PageSize" int not null default 100;
|
||||
|
|
Loading…
Reference in New Issue
Block a user