# Tag-union implementation?

**URL:** https://meta.discourse.org/t/tag-union-implementation/58121
**Category:** Development
**Created:** [February 28, 2017, 8:20pm UTC](https://meta.discourse.org/t/tag-union-implementation/58121 "2017-02-28T20:20:23Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![ebadgley](https://avatars.discourse-cdn.com/v4/letter/e/e19b73/32.png) [@ebadgley](https://meta.discourse.org/u/ebadgley)
#### Post date: [February 28, 2017, 8:20pm UTC](https://meta.discourse.org/t/tag-union-implementation/58121/1 "2017-02-28T20:20:23Z")

</div>

Continuing the discussion from [Tags: category restrictions, tag groups, relationships](https://meta.discourse.org/t/tags-category-restrictions-tag-groups-relationships/48260/6):

I’m interested in building a tag union capability that would mimic how tag intersections are currently implemented ([Tag intersections page](https://meta.discourse.org/t/tag-intersections-page/47952)): 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?](https://meta.discourse.org/t/does-multiple-tag-search-support-and-vs-or/56041)). **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.

---

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [April 20, 2020, 7:21pm UTC](https://meta.discourse.org/t/tag-union-implementation/58121/2 "2020-04-20T19:21:37Z")

</div>

> [@ebadgley](#):
>
> 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.

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

Thoughts? @daniel

---

<div class="post-metadata">

### Author: ![attj](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@attj](https://meta.discourse.org/u/attj)
#### Post date: [August 26, 2022, 10:09am UTC](https://meta.discourse.org/t/tag-union-implementation/58121/3 "2022-08-26T10:09:39Z")

</div>

Has there been any updates on this? It would be very useful to have a /tags/union route.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 28, 2022, 11:46pm UTC](https://meta.discourse.org/t/tag-union-implementation/58121/4 "2022-08-28T23:46:32Z")

</div>

We have it now at least in route form:

[https://meta.discourse.org/?tags[]=screen-reader&tags[]=accessibility](https://meta.discourse.org/?tags%5B%5D=screen-reader&tags%5B%5D=accessibility)

Long term we are thinking of building a UI for cleaner filtering and sorting of topic lists.

---

<div class="post-metadata">

### Author: ![attj](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@attj](https://meta.discourse.org/u/attj)
#### Post date: [August 29, 2022, 12:46am UTC](https://meta.discourse.org/t/tag-union-implementation/58121/5 "2022-08-29T00:46:31Z")

</div>

I get an empty topic list when clicking the url provided:

 ![image](https://global.discourse-cdn.com/meta/original/4X/e/1/c/e1c37a3c27de5d66a53985d981275231c5d45903.jpeg)

Could there be a problem?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 29, 2022, 1:19am UTC](https://meta.discourse.org/t/tag-union-implementation/58121/6 "2022-08-29T01:19:38Z")

</div>

Yeah our Ember router needs to learn about this route (cc @david)

Will work if you directly navigate to the URL

---

<div class="post-metadata">

### Author: ![attj](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@attj](https://meta.discourse.org/u/attj)
#### Post date: [August 29, 2022, 7:35am UTC](https://meta.discourse.org/t/tag-union-implementation/58121/7 "2022-08-29T07:35:49Z")

</div>

Do I need to execute `./launcher rebuild app` to have this update on my self hosted instance?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 29, 2022, 7:56am UTC](https://meta.discourse.org/t/tag-union-implementation/58121/8 "2022-08-29T07:56:15Z")

</div>

I would wait till we fix the client side routing

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [August 29, 2022, 10:43am UTC](https://meta.discourse.org/t/tag-union-implementation/58121/9 "2022-08-29T10:43:00Z")

</div>

> [@sam](#):
>
> Yeah our Ember router needs to learn about this route

Building queryParam arrays using the `paramName[]` syntax is a backend-framework-specific thing, and I don’t think it’s supported natively by Ember. We might be able to make it work, but I just had a quick look at the server-side implementation of the `tags` filter and it looks like we also support a space-separated list.

So, this link should already work without a full page reload: [https://meta.discourse.org/?tags=screen-reader+accessibility](https://meta.discourse.org/?tags=screen-reader+accessibility)

---

<div class="post-metadata">

### Author: ![attj](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@attj](https://meta.discourse.org/u/attj)
#### Post date: [August 29, 2022, 1:08pm UTC](https://meta.discourse.org/t/tag-union-implementation/58121/10 "2022-08-29T13:08:46Z")

</div>

> [@david](#):
>
> I just had a quick look at the server-side implementation of the `tags` filter and it looks like we also support a space-separated list.

This is very neat. However, the page does not keep the restrictions when a category is selected from top left. For pages with single tags, this works as expected.

For instance, If I am at /tag/tag1 and pick site-feedback from top left. It shows /tags/c/site-feedback/2/tag1.

With /?tags=tag1+tag2, it just redirects me to /c/site-feedback/2

Is it possible to have this functionality?

I guess this was requested in these two topics as well:

> [@URL syntax for multiple tags within a category](https://meta.discourse.org/t/url-syntax-for-multiple-tags-within-a-category/169972):
>
> It would be nice to be able to filter topics based on multiple tags within a category using the URL syntax currently available for multiple tags filtering: The output page from this URL filtering looks a lot sleeker than the output from an advanced search.

> [@Is it possible to filter a category by multiple tags?](https://meta.discourse.org/t/is-it-possible-to-filter-a-category-by-multiple-tags/145430):
>
> Currently we can do this: [https://meta.discourse.org/c/bug?tags=admin](https://meta.discourse.org/c/bug?tags=admin) But could we do this? [https://meta.discourse.org/c/bug?tags=admin,email](https://meta.discourse.org/c/bug?tags=admin,email) Where it filters topics in that category containing both tags? (If it’s not possible, could it be added please?)

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [August 29, 2022, 1:57pm UTC](https://meta.discourse.org/t/tag-union-implementation/58121/11 "2022-08-29T13:57:00Z")

</div>

That kind of thing isn’t supported at the moment, but it’s something we’re thinking about improving in the long-term

> [@sam](#):
>
> Long term we are thinking of building a UI for cleaner filtering and sorting of topic lists.
