summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2024-05-28 10:36:00 -0400
committerMark Felder <feld@feld.me>2024-05-28 10:36:00 -0400
commit8743c6c640d395ff6d7d268df1e382ba0fb0ca96 (patch)
tree712eeffb317baf311f2c8e30966b1c0040361cde
parent1b3c84e241f8ed1066d113346365ce489971ac14 (diff)
downloadpleroma-8743c6c640d395ff6d7d268df1e382ba0fb0ca96.tar.gz
pleroma-8743c6c640d395ff6d7d268df1e382ba0fb0ca96.zip
Dialyzer: The pattern can never match the type
We will never pass :plain to query_with/4, so remove that match and change it to query_with/3 lib/pleroma/search/database_search.ex:127:pattern_match The pattern can never match the type. Pattern: _q, :rum, _search_query, :plain Type: %Ecto.Query{ :aliases => _, :assocs => _, :combinations => _, :distinct => _, :from => _, :group_bys => _, :havings => _, :joins => _, :limit => _, :lock => _, :offset => _, :order_bys => _, :prefix => _, :preloads => _, :select => _, :sources => _, :updates => _, :wheres => _, :windows => _, :with_ctes => _ }, :rum, _, :websearch
-rw-r--r--lib/pleroma/search/database_search.ex36
1 files changed, 3 insertions, 33 deletions
diff --git a/lib/pleroma/search/database_search.ex b/lib/pleroma/search/database_search.ex
index c6fe8a9bd..aef5d1e74 100644
--- a/lib/pleroma/search/database_search.ex
+++ b/lib/pleroma/search/database_search.ex
@@ -28,7 +28,7 @@ defmodule Pleroma.Search.DatabaseSearch do
|> Activity.with_preloaded_object()
|> Activity.restrict_deactivated_users()
|> restrict_public(user)
- |> query_with(index_type, search_query, :websearch)
+ |> query_with(index_type, search_query)
|> maybe_restrict_local(user)
|> maybe_restrict_author(author)
|> maybe_restrict_blocked(user)
@@ -88,25 +88,7 @@ defmodule Pleroma.Search.DatabaseSearch do
)
end
- defp query_with(q, :gin, search_query, :plain) do
- %{rows: [[tsc]]} =
- Ecto.Adapters.SQL.query!(
- Pleroma.Repo,
- "select current_setting('default_text_search_config')::regconfig::oid;"
- )
-
- from([a, o] in q,
- where:
- fragment(
- "to_tsvector(?::oid::regconfig, ?->>'content') @@ plainto_tsquery(?)",
- ^tsc,
- o.data,
- ^search_query
- )
- )
- end
-
- defp query_with(q, :gin, search_query, :websearch) do
+ defp query_with(q, :gin, search_query) do
%{rows: [[tsc]]} =
Ecto.Adapters.SQL.query!(
Pleroma.Repo,
@@ -124,19 +106,7 @@ defmodule Pleroma.Search.DatabaseSearch do
)
end
- defp query_with(q, :rum, search_query, :plain) do
- from([a, o] in q,
- where:
- fragment(
- "? @@ plainto_tsquery(?)",
- o.fts_content,
- ^search_query
- ),
- order_by: [fragment("? <=> now()::date", o.inserted_at)]
- )
- end
-
- defp query_with(q, :rum, search_query, :websearch) do
+ defp query_with(q, :rum, search_query) do
from([a, o] in q,
where:
fragment(