Full text search breaks on certain words
Using the mastofe search box to search for the word "manlet" gives a 500 Internal Server Error. On the backend (running the latest dev, commit 4e5b1560) it produces the following error log:
07:51:35.750 request_id=2lrt0bl36trku4e1tc0009th [info] GET /api/v2/search
07:51:35.859 request_id=2lrt0bl36trku4e1tc0009th [info] Converted error :function_clause to 500 response
07:51:35.860 request_id=2lrt0bl36trku4e1tc0009th [info] Sent 500 in 109ms
07:51:35.861 [error] #PID<0.4822.0> running Pleroma.Web.Endpoint (cowboy_protocol) terminated
Server: pleroma.tempus.tk:80 (http)
Request: GET /api/v2/search?q=manlet&resolve=true
** (exit) an exception was raised:
** (FunctionClauseError) no function clause matching in Pleroma.User.visible_for?/2
(pleroma) lib/pleroma/user.ex:54: Pleroma.User.visible_for?(nil, nil)
(pleroma) lib/pleroma/web/mastodon_api/views/account_view.ex:20: Pleroma.Web.MastodonAPI.AccountView.render/2
(pleroma) lib/pleroma/web/mastodon_api/views/status_view.ex:133: Pleroma.Web.MastodonAPI.StatusView.render/2
(elixir) lib/enum.ex:1314: Enum."-map/2-lists^map/1-0-"/2
(elixir) lib/enum.ex:1314: Enum."-map/2-lists^map/1-0-"/2
(pleroma) lib/pleroma/web/mastodon_api/views/status_view.ex:39: Pleroma.Web.MastodonAPI.StatusView.render/2
(pleroma) lib/pleroma/web/mastodon_api/mastodon_api_controller.ex:776: Pleroma.Web.MastodonAPI.MastodonAPIController.search2/2
(pleroma) lib/pleroma/web/mastodon_api/mastodon_api_controller.ex:5: Pleroma.Web.MastodonAPI.MastodonAPIController.action/2
I've managed to reproduce this behaviour on FSE to get the same 500 internal server error.
This (frankly quite amusing) bug came as a surprise to me since full text search has always worked quite well for me in the past. To narrow down the cause I tried immediately a collection of random 6 character strings and none of them managed to break the search in the same way. I also tried some famous slurs and insults and none of them broke search either.
So far I've discovered that the following words broke search on my server: "manlet" "obese" "obesity" and "dwarf" (and all of them with an "s" appended). Curiously enough only the first one is broken on FSE.