Fix object search depending on embeded object
[akkoma] / lib / pleroma / web / mastodon_api / mastodon_api_controller.ex
index 4cec26c9b1b31d9b5723e22b8cb08b4194d91ef2..3916d7c41da3d56443bf57bae630ec9525b1e001 100644 (file)
@@ -1012,13 +1012,13 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
 
     q =
       from(
-        a in Activity,
+        [a, o] in Activity.with_preloaded_object(Activity),
         where: fragment("?->>'type' = 'Create'", a.data),
         where: "https://www.w3.org/ns/activitystreams#Public" in a.recipients,
         where:
           fragment(
-            "to_tsvector('english', ?->'object'->>'content') @@ plainto_tsquery('english', ?)",
-            a.data,
+            "to_tsvector('english', ?->>'content') @@ plainto_tsquery('english', ?)",
+            o.data,
             ^query
           ),
         limit: 20,