Write both summary and content searches in the same where
to keep other conditions
This commit is contained in:
parent
6650c69aaf
commit
e7048471e0
@ -54,16 +54,15 @@ defmodule Pleroma.Activity.Search do
|
|||||||
from([a, o] in q,
|
from([a, o] in q,
|
||||||
where:
|
where:
|
||||||
fragment(
|
fragment(
|
||||||
"(to_tsvector('english', ?->>'summary') @@ plainto_tsquery('english', ?))",
|
"to_tsvector('english', ?->>'summary') @@ plainto_tsquery('english', ?)",
|
||||||
o.data,
|
o.data,
|
||||||
^search_query
|
^search_query
|
||||||
),
|
) or
|
||||||
or_where:
|
fragment(
|
||||||
fragment(
|
"to_tsvector('english', ?->>'content') @@ plainto_tsquery('english', ?)",
|
||||||
"(to_tsvector('english', ?->>'content') @@ plainto_tsquery('english', ?))",
|
o.data,
|
||||||
o.data,
|
^search_query
|
||||||
^search_query
|
)
|
||||||
)
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -72,15 +71,14 @@ defmodule Pleroma.Activity.Search do
|
|||||||
where:
|
where:
|
||||||
fragment(
|
fragment(
|
||||||
"? @@ plainto_tsquery('english', ?)",
|
"? @@ plainto_tsquery('english', ?)",
|
||||||
o.fts_content,
|
|
||||||
^search_query
|
|
||||||
),
|
|
||||||
or_where:
|
|
||||||
fragment(
|
|
||||||
"? @@ plainto_tsquery('english', ?)",
|
|
||||||
o.fts_summary,
|
o.fts_summary,
|
||||||
^search_query
|
^search_query
|
||||||
),
|
) or
|
||||||
|
fragment(
|
||||||
|
"? @@ plainto_tsquery('english', ?)",
|
||||||
|
o.fts_content,
|
||||||
|
^search_query
|
||||||
|
),
|
||||||
order_by: [fragment("? <=> now()::date", o.inserted_at)]
|
order_by: [fragment("? <=> now()::date", o.inserted_at)]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user