forked from MarseyWorld/MarseyWorld
parent
ccc201b3a1
commit
8b984a510e
|
@ -224,11 +224,9 @@ def searchcomments(v):
|
|||
|
||||
if 'q' in criteria:
|
||||
text = criteria['full_text']
|
||||
if '"' in text: regconfig = "simple"
|
||||
else: regconfig = "english"
|
||||
comments = comments.filter(
|
||||
Comment.body_ts.bool_op("@@")(
|
||||
func.websearch_to_tsquery(regconfig, text)
|
||||
func.websearch_to_tsquery("english", text)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -325,11 +323,9 @@ def searchmessages(v):
|
|||
|
||||
if 'q' in criteria:
|
||||
text = criteria['full_text']
|
||||
if '"' in text: regconfig = "simple"
|
||||
else: regconfig = "english"
|
||||
comments = comments.filter(
|
||||
Comment.body_ts.bool_op("@@")(
|
||||
func.websearch_to_tsquery(regconfig, text)
|
||||
func.websearch_to_tsquery("english", text)
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
alter table comments add column body_ts2 tsvector GENERATED ALWAYS AS (to_tsvector('simple'::regconfig, (body)::text)) STORED;
|
||||
alter table comments drop column body_ts;
|
||||
alter table comments rename column body_ts2 to body_ts;
|
|
@ -459,8 +459,8 @@ CREATE TABLE public.comments (
|
|||
queened boolean NOT NULL,
|
||||
sharpened boolean NOT NULL,
|
||||
num_of_pinned_children integer NOT NULL,
|
||||
distinguished boolean NOT NULL,
|
||||
body_ts tsvector GENERATED ALWAYS AS (to_tsvector('simple'::regconfig, (body)::text)) STORED
|
||||
body_ts tsvector GENERATED ALWAYS AS (to_tsvector('english'::regconfig, (body)::text)) STORED,
|
||||
distinguished boolean NOT NULL
|
||||
);
|
||||
|
||||
|
||||
|
@ -3067,4 +3067,3 @@ ALTER TABLE ONLY public.comments
|
|||
--
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
|
||||
|
|
Loading…
Reference in New Issue