merge
authorFloatingGhost <hannah@coffee-and-dreams.uk>
Tue, 14 Dec 2021 14:28:15 +0000 (14:28 +0000)
committerFloatingGhost <hannah@coffee-and-dreams.uk>
Tue, 14 Dec 2021 14:28:15 +0000 (14:28 +0000)
lib/mix/tasks/pleroma/activity.ex
lib/mix/tasks/pleroma/search.ex
lib/pleroma/elasticsearch/store.ex
lib/pleroma/search/elasticsearch/hashtag_parser.ex
lib/pleroma/search/elasticsearch/user_paser.ex

index ca9224b67abe523df8ea86158a41c4df9d0fabed..3a79d8f206ded11728c788b1f051b2f26ba6c5bd 100644 (file)
@@ -4,7 +4,6 @@
 
 defmodule Mix.Tasks.Pleroma.Activity do
   alias Pleroma.Activity
-  alias Pleroma.Activity.Search
   alias Pleroma.User
   alias Pleroma.Web.CommonAPI
   alias Pleroma.Pagination
index 2324561c1baaed6736da3ab101e0adc72a3e732a..1fd880eab61fe9a4037c59432494fe702e29a865 100644 (file)
@@ -24,8 +24,8 @@ defmodule Mix.Tasks.Pleroma.Search do
   end
 
   def run(["import", "users" | _rest]) do
-    start_pleroma()  
-                     
+    start_pleroma()
+
     from(u in User, where: u.nickname not in ["internal.fetch", "relay"])
     |> get_all(:users)
   end
index 2d8aeabc29d539708c2755494ff38889e92b1de6..2f8375c48fb4f0e2b40c2cc7faee66287bc14653 100644 (file)
@@ -46,26 +46,31 @@ defmodule Pleroma.Elasticsearch do
   end
 
   def put(%Activity{} = activity) do
-    {:ok, _} = Elastix.Document.index(
-      url(),
-      "activities",
-      "activity",
-      DocumentMappings.Activity.id(activity),
-      DocumentMappings.Activity.encode(activity)
-    )
-    {:ok, _} = bulk_post(
-        activity.object.hashtags, :hashtags
-    )
+    {:ok, _} =
+      Elastix.Document.index(
+        url(),
+        "activities",
+        "activity",
+        DocumentMappings.Activity.id(activity),
+        DocumentMappings.Activity.encode(activity)
+      )
+
+    {:ok, _} =
+      bulk_post(
+        activity.object.hashtags,
+        :hashtags
+      )
   end
 
   def put(%User{} = user) do
-    {:ok, _ } = Elastix.Document.index(
-      url(),
-      "users",
-      "user",
-      DocumentMappings.User.id(user),
-      DocumentMappings.User.encode(user)
-    )
+    {:ok, _} =
+      Elastix.Document.index(
+        url(),
+        "users",
+        "user",
+        DocumentMappings.User.id(user),
+        DocumentMappings.User.encode(user)
+      )
   end
 
   def bulk_post(data, :activities) do
@@ -87,12 +92,13 @@ defmodule Pleroma.Elasticsearch do
       end)
       |> List.flatten()
 
-    {:ok, %{body: %{"errors" => false}}} = Elastix.Bulk.post(
-      url(),
-      d,
-      index: "activities",
-      type: "activity"
-    )
+    {:ok, %{body: %{"errors" => false}}} =
+      Elastix.Bulk.post(
+        url(),
+        d,
+        index: "activities",
+        type: "activity"
+      )
   end
 
   def bulk_post(data, :users) do
index 6e2801ed07aea0428d34e160425f5046ab484628..644969c786394722cc6c9db413af0e969ee20f76 100644 (file)
@@ -3,7 +3,7 @@ defmodule Pleroma.Search.Elasticsearch.Parsers.Hashtag do
     %{
       term: %{
         hashtag: %{
-          value: String.downcase(term),
+          value: String.downcase(term)
         }
       }
     }
index 96bfdc7d259f4a3745d28f4b181c99f2dd39b5f3..76da3bd3330e366af54d71443c5ac4d3d278dc63 100644 (file)
@@ -25,7 +25,7 @@ defmodule Pleroma.Search.Elasticsearch.Parsers.User do
                 query: term,
                 operator: "AND"
               }
-            }  
+            }
           }
         ]
       }