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 Likes

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

Thoughts? @daniel

1 Like

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

1 Like

We have it now at least in route form:

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

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

3 Likes

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

Could there be a problem?

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

Will work if you directly navigate to the URL

2 Likes

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

I would wait till we fix the client side routing

1 Like

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

2 Likes

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:

1 Like

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

3 Likes