Tag-union implementation?

Continuing the discussion from Tags: category restrictions, tag groups, relationships:

I’m interested in building a tag union capability that would mimic how tag intersections are currently implemented (Tag intersections page): essentially the same result as intersections (the default category/Latest view), but doing an OR on multiple tags rather than an AND. I would appreciate any suggestions as a new Discourse developer.

My thoughts (so far) are as follows:

  • Searching on multiple tags via the search page essentially provides tag-union functionality (Does multiple tag search support AND vs OR?). The problem is that I don’t want the search results view – I want the default category page. Could search results be redirected to accomplish this?

  • If search results can’t be redirected, I’m open to attempting a /tags/union/ route (and have been looking into how intersection works). I would prefer to do this via plugin, but I am concerned that that is not something that could currently be accomplished via a plugin. Any suggestions here would be appreciated.

If there is sufficient user interest to add a tag-union capability into the Discourse core, I’d be willing to do it and submit a PR, but I’m hoping to find an alternative. Thanks in advance.

4 个赞

Not sure this counts as sufficient user interest, but intending to revive this discussion to see if users/team are interested.

Thoughts? @daniel

1 个赞

这方面有任何更新吗?拥有一个 /tags/union 路由将非常有用。

1 个赞

我们现在已经有了,至少是路由形式:

https://meta.discourse.org/?tags[]=screen-reader&tags[]=accessibility

长期来看,我们正在考虑构建一个用户界面,用于更清晰地过滤和排序主题列表。

4 个赞

当我点击提供的 URL 时,我得到一个空的讨论列表:

会不会有问题?

是的,我们的 Ember 路由器需要了解这个路由(cc @david

如果你直接导航到 URL,它就能工作

2 个赞

我需要在我的自托管实例上应用此更新,是否需要执行 ./launcher rebuild app

我等到我们修复客户端路由再说

1 个赞

使用 paramName[] 语法构建 queryParam 数组是后端框架特定的,我不认为 Ember 原生支持它。我们也许能让它工作,但我只是快速看了一下 tags 过滤器的服务器端实现,看起来我们也支持空格分隔的列表。

所以,这个链接应该已经可以在不完全重新加载页面的情况下工作了:https://meta.discourse.org/?tags=screen-reader+accessibility

2 个赞

这非常好。但是,当从左上角选择一个类别时,页面不会保留限制。对于具有单个标签的页面,这按预期工作。

例如,如果我在 /tag/tag1,然后从左上角选择 site-feedback。它显示 /tags/c/site-feedback/2/tag1。

使用 /?tags=tag1+tag2,它只会重定向到 /c/site-feedback/2

这有可能实现吗?

我想在以下两个主题中也提出了这个要求:

1 个赞

目前不支持此类操作,但我们正在考虑在长期内进行改进。

3 个赞