forked from rDrama/rDrama
Revert "much better way of fixing exact searching that doesn't break shit"
This reverts commit 1cb7b72d62
.
master
parent
2597580992
commit
f73a1d4e5f
|
@ -224,17 +224,11 @@ def searchcomments(v):
|
||||||
|
|
||||||
if 'q' in criteria:
|
if 'q' in criteria:
|
||||||
text = criteria['full_text']
|
text = criteria['full_text']
|
||||||
if text.startswith('"') and text.endswith('"'):
|
comments = comments.filter(
|
||||||
search_text = escape_for_search(text[1:-1])
|
Comment.body_ts.bool_op("@@")(
|
||||||
comments = comments.filter(
|
func.websearch_to_tsquery("english", text)
|
||||||
Comment.body.ilike(f'%{search_text}%')
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
comments = comments.filter(
|
|
||||||
Comment.body_ts.bool_op("@@")(
|
|
||||||
func.websearch_to_tsquery("english", text)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if 'nsfw' in criteria:
|
if 'nsfw' in criteria:
|
||||||
nsfw = criteria['nsfw'].lower().strip() == 'true'
|
nsfw = criteria['nsfw'].lower().strip() == 'true'
|
||||||
|
@ -329,17 +323,11 @@ def searchmessages(v):
|
||||||
|
|
||||||
if 'q' in criteria:
|
if 'q' in criteria:
|
||||||
text = criteria['full_text']
|
text = criteria['full_text']
|
||||||
if text.startswith('"') and text.endswith('"'):
|
comments = comments.filter(
|
||||||
search_text = escape_for_search(text[1:-1])
|
Comment.body_ts.bool_op("@@")(
|
||||||
comments = comments.filter(
|
func.websearch_to_tsquery("english", text)
|
||||||
Comment.body.ilike(f'%{search_text}%')
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
comments = comments.filter(
|
|
||||||
Comment.body_ts.bool_op("@@")(
|
|
||||||
func.websearch_to_tsquery("english", text)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
comments = apply_time_filter(t, comments, Comment)
|
comments = apply_time_filter(t, comments, Comment)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue