Revert "fix exact searching"

This reverts commit 755a1ff60d.
master
Aevann 2024-02-28 22:02:08 +02:00
parent ccc201b3a1
commit 8b984a510e
3 changed files with 4 additions and 12 deletions

View File

@ -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)
)
)

View File

@ -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;

View File

@ -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
--