Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support OR for filter tags #1386

Open
cellio opened this issue Sep 2, 2024 · 3 comments
Open

Support OR for filter tags #1386

cellio opened this issue Sep 2, 2024 · 3 comments
Labels
area: ruby Changes to server-side code complexity: average Not particularly hard, not particularly trivial. priority: high type: change request New feature or request

Comments

@cellio
Copy link
Member

cellio commented Sep 2, 2024

meta:291534

When you define a filter, you can specify tags to include and/or to exclude. The exclude list is an OR, but the include list is an AND. This means you can't write a filter that includes several related tags.

Some people might want the current AND behavior, so rather than making a global decision for all filters, can we add an option for the "include" list to choose "any (OR)" or "all (AND)"? The default would be the current behavior (AND).

I don't know if we want to offer this option for the exclude list too. On the one hand, consistency is good. On the other, I'm having trouble coming up with a use case.

@cellio cellio added area: ruby Changes to server-side code type: change request New feature or request priority: medium complexity: unassessed Needs further developer investigation before complexity/feasibility can be determined. labels Sep 2, 2024
@trichoplax
Copy link
Contributor

I also can't personally think of a use case for AND in the exclude list.

For the include list, I can imagine some people wanting a combination of both behaviours, so it might be worth thinking about how this could be provided, rather than the all or nothing approach. This would allow things like (A OR B) AND C.

For example, someone might want to see posts that are tagged ("chinese-dragon" OR "european-dragon") AND "fire-safety".

In that first example an alternative solution might be to have a parent tag "dragon" so someone can see posts that are tagged "dragon" AND "fire-safety", but I can imagine other combinations that might not be solvable this way. For example ("geometry" OR "algebra") AND "visual-proof" probably can't be fixed with a parent tag as this would include other child tags that aren't intended.

I don't know the best approach, but here's a thought:

Have several boxes, and tags can be added to any of them. Each box requires all tags to be present (has AND behaviour), but posts are shown that match any of the boxes. So the results match (all of box 1) OR (all of box 2) or (all of box 3).

Now the dragon example could have box 1 with "chinese-dragon" and "fire-safety", and box 2 with "european-dragon" and "fire-safety".

I think this would cover a wider range of use cases, but it would be more prone to misinterpretation so it would require careful wording.

It might be worth implementing the all or nothing approach you suggest first, then seeing if there is any demand for finer control before putting effort into implementing anything more.

@ArtOfCode- ArtOfCode- added complexity: average Not particularly hard, not particularly trivial. and removed complexity: unassessed Needs further developer investigation before complexity/feasibility can be determined. labels Sep 7, 2024
@ArtOfCode-
Copy link
Member

Needs a field added to the model for include_tags_mode and set to AND for all existing filters, then qualifiers_to_sql updated to check for it, then the UI updating.

@trichoplax
Copy link
Contributor

trichoplax commented Oct 5, 2024

For prioritisation purposes:

A user posted on Meta expecting that the "Include Tags" section would be "OR" already (mentioned in the comments): No question shown if two tags set in filter so at least one user is confused by the current behaviour.

(I haven't been able to work out why they were seeing more results previously.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ruby Changes to server-side code complexity: average Not particularly hard, not particularly trivial. priority: high type: change request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants