Fix path format queries for multi-valued fields#6635
Open
oxms16 wants to merge 1 commit into
Open
Conversation
|
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6635 +/- ##
==========================================
+ Coverage 72.15% 72.39% +0.23%
==========================================
Files 159 159
Lines 20645 20653 +8
Branches 3269 3272 +3
==========================================
+ Hits 14897 14952 +55
+ Misses 5041 4976 -65
- Partials 707 725 +18
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #6598.
(...)
To Do
the issue was that path format queries are evaluated against an in-memory Item using query.match(), where multi-valued fields such as genres are represented as lists, e.g. ["Classical"]. Before this change, string/exact matching treated that list as one whole value, so a path rule like genres:=~Classical: _Classical/... failed to match and fell back to the default path format, even though beet list genres:=~Classical worked through the database query path. This change updates in-memory matching so sequence-like field values are matched element by element, while excluding strings and byte-like values from sequence handling. I added regression tests for genres:=~Classical, genres:=Classical, avoiding a false positive for Neoclassical, and direct query.match() behavior on multi-valued fields. Manual verification showed the original version returned match: False and destination: ...\one\two, while the fixed version returns match: True and destination: ...\one\three.
-->
[yes]This is a bug fix for existing behavior and does not add or change user-facing configuration.
[no]Changelog. I can add an entry after review if maintainers prefer.
[yes]Tests.
Summary
This fixes path format selection for multi-valued fields such as
genres.Path format queries are evaluated against an in-memory
Itemviaquery.match().For multi-valued fields, the in-memory value is a list, for example: