你好,
有没有什么(简单的)方法可以在我的 Discourse 上实现通配符搜索功能?
我在公司内部本地运行一个小型的封闭 Discourse 论坛。用户只有大约 10 人,所以帖子数量远不如大型社区那么多。
我看到了这个 Algolia 插件,它看起来非常完美,但问题是它需要对论坛进行索引,而我们无法让数据离开本地网络。
我希望在搜索“322X”时能找到像“DE322X”这样的内容 ![]()
你好,
有没有什么(简单的)方法可以在我的 Discourse 上实现通配符搜索功能?
我在公司内部本地运行一个小型的封闭 Discourse 论坛。用户只有大约 10 人,所以帖子数量远不如大型社区那么多。
我看到了这个 Algolia 插件,它看起来非常完美,但问题是它需要对论坛进行索引,而我们无法让数据离开本地网络。
我希望在搜索“322X”时能找到像“DE322X”这样的内容 ![]()
There might be a couple of ways to do this using our Discourse Data Explorer Plugin.
You could run this simple query and then click the CSV button to download all posts. Then, you could search across the exported file using a different program.
`SELECT id, raw from posts`
You could write a custom data explorer query to search for the keyword across all post content.
Using the Data Explorer here would ensure that your data doesn’t leave the local network.
Thanks, I will save this for later. Might come in handly 
But for this I need the whole team to be able to search stuff and would be a real hassle if everyone needed to dump a CSV file every time to find what they need 
Sure, then writing a custom query and seeing the results in the UI would be the way to go. See What cool data explorer queries have you come up with? for inspiration on writing queries.
在一个足够小的站点上,类似这样的东西可能会起作用:
-- [params]
-- string :query
SELECT p.id AS post_id,
p.user_id
FROM posts p
WHERE p.raw ~* :query
AND p.deleted_at IS NULL
不过,如果你想进一步限制,也许可以添加一个特定的类别或日期范围。
写好之后,你可以让某些群组使用它:
不过,我很欣赏它能在搜索栏中工作,这应该是发帖人想要的。
我将把它移到 Feature,以防有更多需求。