LemmyNet / lemmy-ui

The official web app for lemmy.
https://join-lemmy.org/
GNU Affero General Public License v3.0
888 stars 334 forks source link

Searching for remote community with filter `community` gives no results #1287

Open maltfield opened 1 year ago

maltfield commented 1 year ago

Issue Summary

If you search for a new community (not yet known to a server) using its shorthand identifier (eg !support@lemmy.nz) while filtering the Type of results to Communites, then the community will not appear in the results.

Note that if you do the "wait a minute and search again" workaround for the known async bug, the results still won't show. But if you remove the filter (change Type = Communities to Type = All), then the result will show

Steps to Reproduce

  1. Go to some small instance
  2. Go to the search page of that instance /search
  3. Change the Type from All to Communites
  4. Search for some remote community (eg !support@lemmy.nz)
  5. Wait a minute
  6. Click Search again (to confirm this is not an already-known bug)
  7. See no results
  8. Change the Type from Communities to All
  9. Click Search
  10. See the result
  11. Change the Type again back from All to Communites
  12. Click Search
  13. Again, the result disappears (confirming this bug)

Technical details

I'm using Firefox v102.11.0esr on Debian 11

AustinHellerRepo commented 1 year ago

It doesn't matter which Type I supply, I never get back results when searching for communities. I'm running the latest arm64 images for lemmy and lemmy-ui on my Raspberry Pi 4. I have the following error logs from my lemmy container when I search for !selfhosted@lemmy.world:

lemmy_1     | 2023-06-14T13:07:43.390679Z ERROR HTTP request{http.method=GET http.scheme="http" http.host=REDACTED_MY_LEMMY_DOMAIN http.target=/api/v3/ws otel.kind="server" request_id=9d892bee-f387-4358-8eac-742c3f69e397 http.status_code=101 otel.status_code="OK"}: lemmy_server::api_routes_websocket: couldnt_find_object: Request error: error sending request for url (https://lemmy.world/.well-known/webfinger?resource=acct:selfhosted@lemmy.world): operation timed out
lemmy_1     |    0: lemmy_apub::fetcher::search::search_query_to_object_id
lemmy_1     |              at crates/apub/src/fetcher/search.rs:17
lemmy_1     |    1: lemmy_apub::api::resolve_object::perform
lemmy_1     |            with self=ResolveObject { q: "!selfhosted@lemmy.world", auth: Some(Sensitive) }
lemmy_1     |              at crates/apub/src/api/resolve_object.rs:21
lemmy_1     |    2: lemmy_server::root_span_builder::HTTP request
lemmy_1     |            with http.method=GET http.scheme="http" http.host=REDACTED_MY_LEMMY_DOMAIN http.target=/api/v3/ws otel.kind="server" request_id=9d892bee-f387-4358-8eac-742c3f69e397 http.status_code=101 otel.status_code="OK"
lemmy_1     |              at src/root_span_builder.rs:16

Edit: It looks like this post contains a solution. I'll try it out. https://github.com/LemmyNet/lemmy/issues/2990

Edit: And that fixed my issue. Woot!

AustinHellerRepo commented 1 year ago

@Nutomic My issue was resolved, but I don't know if the issue that @maltfield is experiencing has been resolved.

maltfield commented 1 year ago

@Nutomic was this actually fixed? Or was the issue accidentally closed?

This issue still appears to be present for me on lemmy.ml running v0.17.4 (for example when searching for !open_source_ecology@slrpnk.net with filter set to Type = Communities).

Note that this bug is not just another "instance can't find remote instances" due to a server misconfiguration or known async lag. This occurs when the instance does know about the other instance, but the filter just doesn't include them.

shadone commented 1 year ago

I see the same issue still present - searching for e.g. !biology@mander.xyz with "type_"="Community" doesn't produce any results:

$ curl 'https://discuss.tchncs.de/api/v3/search?q=!biology%40mander.xyz&listing_type=All&limit=3&type_=Communities' | jq
{
  "type_": "Communities",
  "comments": [],
  "posts": [],
  "communities": [],
  "users": []
}

However "resolve_object" endpoint returns the result correctly

$ curl 'https://discuss.tchncs.de/api/v3/resolve_object?q=!biology%40mander.xyz' | jq
{
  "comment": null,
  "post": null,
  "community": {
    "community": {
      "id": 875,
      "name": "biology",
...

Same with "post/list" working just fine:

$ curl 'https://discuss.tchncs.de/api/v3/post/list?community_name=biology%40mander.xyz&sort=Active&limit=1' | jq
{
  "posts": [
    {
      "post": {
        "id": 58397,
...
        "ap_id": "https://mander.xyz/post/196780",
      },

To be honest I do not understand the search api, I tried search in various ways with no avail. For example this request gives me ocaml community 🤷

$ curl 'https://discuss.tchncs.de/api/v3/search?q=&community_name=biology%40mander.xyz&listing_type=All&limit=3&type_=Communities' | jq
{
  "type_": "Communities",
  "comments": [],
  "posts": [],
  "communities": [
    {
      "community": {
        "id": 2029,
        "name": "ocaml",
...
        "actor_id": "https://discuss.tchncs.de/c/ocaml",
...
Nutomic commented 1 year ago

Seems like its a frontend issue then.

maltfield commented 1 year ago

Ah, sorry I opened it in the wrong repo :(

shadone commented 1 year ago

Is it a frontend issue if it can be reproduced using REST api? I assumed lemmy-ui proxies REST api to Lemmy itself. Disclaimer: I am only days old in Lemmy world, still trying to grasp the concepts here.

RaoulDukeNZ commented 1 year ago

I'm having the same issue on FF for Android & Windows. I'm also using lemmy.nz, not sure if that's just a coincidence. Some things I've noticed about the bug that might help:

ilmagico commented 1 year ago

Every single instance I tried (lemmy.ml, lemmy.world, lemmy.one, etc.) seems to be affected. Searching for a remote community, whether that community is already known to that server or not, returns zero results: Example: https://lemmy.ml/search?q=ukraine%40sopuli.xyz&type=Communities&listingType=All&page=1&sort=TopAll

image

This might actually be a backend issue, this is the URL that lemmy.ml (v0.18.0) uses to retrieve the results in the example above: https://lemmy.ml/api/v3/search?q=ukraine%40sopuli.xyz&type_=Communities&sort=TopAll&listing_type=All&page=1&limit=40

Note that this only happens when searching, and lemmy.ml already knows about that community. This request returns the expected result: https://lemmy.ml/api/v3/community?name=ukraine@sopuli.xyz

ilmagico commented 1 year ago

I just opened https://github.com/LemmyNet/lemmy/issues/3498 for what seems to be a backend issue.