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

Improving keyword filtering #907

Open
jlvdb opened this issue May 26, 2024 · 2 comments
Open

Improving keyword filtering #907

jlvdb opened this issue May 26, 2024 · 2 comments
Milestone

Comments

@jlvdb
Copy link

jlvdb commented May 26, 2024

When filtering on keywords, the current behavior seems to be that only images are selected that match all the selected keywords. However, if an image has multiple keywords/tags, the image is only selected if all the tags have been selected, which makes it difficult to find such photos.

My suggestion would be to change the behavior from matching images that have all to having any of the selected keywords/tags.

@jlvdb
Copy link
Author

jlvdb commented May 31, 2024

After trying to figure out what the corresponding code does (in FilterService.applyFilters), it seems to be a limitation of the current implementation when dealing with meta data that are array-like (isArrayValue), such as the keywords. The filtering is done "in reverse", i.e. the code goes through all unselected keywords and rejects images that contain them. While this is fine for single value meta data, for arrays this leads to unexpected behavior.

Example

An example: You select keyA and keyB, which means deselecting keyC. You have images A (with keywords keyA), AB (with keywords keyA, keyB), AC (with keywords keyA, keyC), and ABC (with keywords keyA, keyC, keyC).

Expected result

  • AB and ABC are selected because they have both, keyA and keyB.
  • AC and A are not selected because they don't have keyB.

Actual result

  • AB and A are kept in the result because they don't have keyC.
  • AC and ABC are unselected because they do have keyC.

The selection for cases, where only some of the keywords or additional keywords are present, are being reversed.

@bpatrik
Copy link
Owner

bpatrik commented Jun 28, 2024

Yeah I agree that indeed seems to be confusing.

If you have the time, I would appreciate if you can send a PR. Otherwise I don't I will get to it any time soon like O(years)

@bpatrik bpatrik added this to the Future milestone Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants