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