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.

이것이 충분한 사용자 관심에 해당하는지는 모르겠지만, 사용자나 팀이 이 기능에 관심이 있는지 확인하기 위해 이 토론을 다시 활성화하려고 합니다.

생각하시는 점이 있으신가요? @daniel

이 문제에 대해 업데이트가 있나요? /tags/union 라우트가 있으면 매우 유용할 것 같습니다.

최소 루트 형태로는 이미 확보했습니다:

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

장기적으로는 주제 목록을 더 깔끔하게 필터링하고 정렬할 수 있는 UI를 구축하는 것을 고려하고 있습니다.

제공된 URL을 클릭하면 빈 주제 목록이 표시됩니다:

문제가 있는 것일까요?

네, 우리 Ember 라우터가 이 라우트에 대해 알아야 합니다 (cc @david)

URL로 직접 이동하면 작동합니다

자체 호스팅 인스턴스에 이 업데이트를 적용하려면 ./launcher rebuild app을 실행해야 하나요?

클라이언트 사이드 라우팅을 수정할 때까지 기다릴 것입니다

paramName[] 문법을 사용하여 queryParam 배열을 생성하는 것은 백엔드 프레임워크에 특화된 기능이며, Ember에서 기본적으로 지원되지 않는다고 생각합니다. 작동하도록 만들 수 있을지 모르겠지만, 방금 tags 필터의 서버 측 구현을 간단히 살펴봤는데, 공백으로 구분된 목록도 지원하는 것 같습니다.

따라서 이 링크는 이미 전체 페이지 리로드 없이 작동해야 합니다: https://meta.discourse.org/?tags=screen-reader+accessibility

정말 멋진 기능입니다. 다만, 왼쪽 위에서 카테고리를 선택하면 제한 조건이 유지되지 않습니다. 단일 태그의 경우 페이지는 예상대로 작동합니다.

예를 들어, /tag/tag1에 있을 때 왼쪽 위에서 site-feedback을 선택하면 /tags/c/site-feedback/2/tag1이 표시됩니다.

/?tags=tag1+tag2의 경우, 단순히 /c/site-feedback/2로 리다이렉트됩니다.

이 기능을 사용할 수 있을까요?

이 기능이 다음 두 주제에서도 요청되었던 것 같습니다:

이런 기능은 현재 지원되지 않지만, 장기적으로 개선할 수 있는 부분으로 고려하고 있습니다.