social-app
social-app copied to clipboard
Search for hashtags doesn't return any result
Describe the bug
When searching for any hashtag, the search returns nothing.
To Reproduce
Steps to reproduce the behavior:
- Search for a hashtag for example #hazbinhotel
Expected behavior
The search should return posts containing this hashtag.
Details
- Platform: web and iOS
- App version: 1.63
Additional context
While still not supported as interactive elements, hashtags are widely used for people and feeds to tag and find contents (especially for fandoms, series, artists). Sometimes hashtags are the only way to find content since some shows/topics use everyday words that would otherwise return non-relevant content.
I run into this a few days ago. Am quite sure that it broke somewhere along the way and used to work in earlier versions.
Might be from the switch to the new search service, although it's not like the previous one actually searched by hashtag IIRC
not like the previous one actually searched by hashtag IIRC
Yes, I seem to be mistaken. From June 2023: "Even in its simplest form (allow search for them ..."
Another issue is that when a word is into a hashtag, you can't even look for it.
A post with #house won't show up in search results if you look for "house".
This seems to have been somewhat improved — You can now search for "art", and bluesky will return posts containing both "art" and "#art". However, searching for "#art" results in the term being ignored.
The easiest way to see this in action: Searching "from:username.bsky.app #art" will unexpectedly return all posts by the user, whereas "from:username.bsky.app art" will act as expected and only return posts from the user containing the word "art".
I think I know why hashtags aren't shown.
The search is performed in Search.tsx
, via useActorSearch
in actor-search.ts
, which calls searchActors
on the agent. The agent is defined by atproto/api; the searchActors
method does an API call to app.bsky.actor.searchActors
. The query eventually passes through the ParseQuery
function in the backend.
That ParseQuery
function splits the query using https://github.com/google/shlex, but shlex (as the name implies) splits the string as if it's shell syntax, throwing away shell comments* - everything after and including "#". This causes the query "#a_tag" to be equivalent to "" (empty string), and from:username.bsky.app #art
to be equivalent to from:username.bsky.app
.
*This behavior is easily reproduced on the Go Playground:
package main
import (
"fmt"
"github.com/google/shlex"
)
func main() {
// [abc foo]
fmt.Println(shlex.Split("abc foo #def ghi"))
}
Edit: filed as https://github.com/bluesky-social/indigo/issues/578.
Additionally, this:
https://github.com/bluesky-social/social-app/blob/b9301befb701e3562de81294048163c62349bcbe/src/state/queries/actor-search.ts#L14-L16
-
prefix
probably needs to be url-encoded? - I'm guessing
term
should be replaced withq
, asterm
is marked as deprecated in atproto/api
A fix has been made as a PR at https://github.com/bluesky-social/indigo/pull/579.
It has been merged. I think it'll take effect when a new version of Bluesky is uploaded to the servers.
EDIT: It just took a while to take effect. So, I think this issue should be closed.
Yup, this has been fixed. Thank you for reporting!