4350pChris / slack-vuesualizer

Display and search your Slack export
https://slack-vuesualizer.de
MIT License
50 stars 9 forks source link

Message search function does not work properly. #811

Closed Wangzx9908 closed 2 months ago

Wangzx9908 commented 2 months ago

I can use db.messages.find({ text: <searching object> }) get the right answer in MongoDB But when I try to search this message on Vuesualizer, I am not able to get the right answe. I have tried some changing on server/api/messages/search.get.ts , but I failed.

I would like to know how to modify this search mechanism to achieve the effect of slack original searching function Thank you!

4350pChris commented 2 months ago

Have you tried clicking the checkbox in the search bar to search in all channels? By default it only searches in the channel you're currently seeing.

Wangzx9908 commented 2 months ago

yes, I did it. I think the existing algorithm mechanism cannot get the correct matching results, even if a message exists in the channel. I tried to echo the search results in server/api/messages/search.get.ts, but I couldn't get the expected results.

4350pChris commented 2 months ago

Are you searching in chinese maybe? Honestly I'm not sure how mongo handles languages that don't use the latin alphabet.

Maybe show me the full code that produces a search result (so search term and what you want to find) because I don't know how to investigate this without a specific example.

Wangzx9908 commented 2 months ago

Hello, I think I found this reason, If the messages contain CJK it will not be searched, the message searching function is wrote in $text: { $search: query.toString() . and the mongodb search function is not support the CJK (Chinese Japanese Korean). And I try to switch the search function to regular expression matching, [{ text: { $regex: query.toString(), $options: 'i' } }] which can fix the searching CJK but will take more searching time.