Searching posts that contains "#" symbol does not work
I'm trying to make a query that returns a list of hasthags based on the current posts, so I could get the trending topics. I have the following query:
But is not returning anything, even though there are posts that contains "#" in their content, as shown in the attached image. I don't know if has something to do with the character itself, because if I change the search term, for let's say, the character 'b', it does work.

7 Replies
This is the schema for the posts document:
Can you run the search query .collect() using "f" as the query and log immediately after the collect? Should at least return "my first post with images". That'll confirm whether this is a hash symbol issue in Convex search or something else.
yeah sounds like this is specific to hashtag
and assuming you've logged right after collect with hashtag and it's empty
yes, if i do:
I get the log in the attached image

I believe the tokenizer only handles alphanumeric characters and splits on everything else as punctuation.
You may want to parse and handle hash tags and store them individually, depending on what sort of behavior you're going for. Happy to help hash out a solution (pun not intended)
I do need some help with this. My application is a social network where users can post content and include hashtags like "#convex" or "#base". My intention is to track the usage of these hashtags across posts and eventually display them in a "Trending Topics" section on the feed, showing the most popular hashtags.
Given that the tokenizer currently splits on non-alphanumeric characters, I was wondering if you could help me come up with a solution to properly handle hashtags and how to store them separately so I can implement this feature.
Looking forward to your suggestions!