Tag-union implementation?

AI-generated summary

Tag-union Implementation Discussion

ebadgley initiated a discussion on implementing a tag union capability in Discourse, which would allow users to see topics with at least one of multiple specified tags. Currently, Discourse only supports tag intersections (AND) by default.

ebadgley proposed two possible solutions:

  1. Redirecting search results to the default category page.
  2. Creating a /tags/union/ route, possibly via a plugin.

sam revealed that a tag union route is already available in the form of https://meta.discourse.org/?tags[]=screen-reader&tags[]=accessibility, although it requires direct navigation to work due to Ember router limitations.

david suggested an alternative syntax using a space-separated list, e.g., https://meta.discourse.org/?tags=screen-reader+accessibility, which currently works but does not persist when selecting a category.

attj pointed out that this functionality does not work when selecting a category from the top left menu and requested a solution.

david acknowledged the limitation and mentioned that improving filtering and sorting of topic lists is a long-term goal for the Discourse team.

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.

Ich bin mir nicht sicher, ob dies als „ausreichendes Nutzerinteresse

Gab es hierzu neue Entwicklungen? Es wäre sehr nützlich, eine Route /tags/union zu haben.

Wir haben es jetzt zumindest in Routenform:

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

Langfristig denken wir darüber nach, eine Benutzeroberfläche für eine sauberere Filterung und Sortierung von Themenlisten zu entwickeln.

Ich erhalte eine leere Themenliste, wenn ich auf die angegebene URL klicke:

Könnte es ein Problem geben?

Ja, unser Ember-Router muss von dieser Route erfahren (cc @david)

Funktioniert, wenn Sie direkt zur URL navigieren

Muss ich ./launcher rebuild app ausführen, um dieses Update auf meiner selbst gehosteten Instanz zu erhalten?

Ich würde warten, bis wir das Client-seitige Routing behoben haben.

Das Erstellen von queryParam-Arrays mit der Syntax paramName[] ist etwas, das von Backend-Frameworks abhängt, und ich glaube nicht, dass es von Ember nativ unterstützt wird. Wir könnten es vielleicht zum Laufen bringen, aber ich habe mir gerade die serverseitige Implementierung des tags-Filters angesehen und es sieht so aus, als ob wir auch eine durch Leerzeichen getrennte Liste unterstützen.

Daher sollte dieser Link bereits ohne vollständiges Neuladen der Seite funktionieren: https://meta.discourse.org/?tags=screen-reader+accessibility

Das ist sehr praktisch. Allerdings behält die Seite die Einschränkungen nicht bei, wenn eine Kategorie von oben links ausgewählt wird. Bei Seiten mit einzelnen Tags funktioniert dies wie erwartet.

Wenn ich zum Beispiel unter /tag/tag1 bin und oben links site-feedback auswähle. Es wird /tags/c/site-feedback/2/tag1 angezeigt.

Mit /?tags=tag1+tag2 leitet es mich einfach zu /c/site-feedback/2 weiter.

Ist diese Funktionalität möglich?

Ich vermute, dass dies auch in diesen beiden Themen angefordert wurde:

So etwas wird im Moment nicht unterstützt, aber wir denken darüber nach, dies langfristig zu verbessern.