-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add case-insensitive parsing for Lancelot key notation #14318
Add case-insensitive parsing for Lancelot key notation #14318
Conversation
When a user types in "key:5a" into the search field, the intent is probably to search for "key:5A" instead of doing a text-only search. The only case where this is ambigous is for the d/m (OpenKey) and D/M (Lancelot) suffixes, where lowercase will imply OpenKey, and uppercase will imply Lancelot.
I know that case-insensitivity was intentionally removed when adding the advanced Lancelot notations "ILMDPC" (though I haven't yet found a document describing which scales these are associated with), but this has caused a sub-par user experience: Typing
Footnote 1: We can avoid the ambiguity issue for Footnote 2: Every other searchable field is case insensitive, so the case sensitivity for the special case of Footnote 3: While the more flexible parsing is definitely desirable for search queries, I am not 100% sure about e.g. metadata parsing - though I think that even here, a bit of informed guessing is preferable over returning no data at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this nice improvement! Some minor change request but otherwise good to go
src/track/keyutils.cpp
Outdated
QStringLiteral("\\A(?:^\\s*0*(1[0-2]|[1-9])([ABILMDPC])\\s*$)\\z")); | ||
constexpr std::string_view s_lancelotMajorModes = "BILM"; | ||
QStringLiteral("\\A(?:^\\s*0*(1[0-2]|[1-9])([ABILMDPCabilmdpc])\\s*$)\\z")); | ||
constexpr std::string_view s_lancelotMajorModes = "BILMbilm"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be easier to read to us toLower()
on line 462. toLower
will effectively make a single subtraction, while doubling the size might significantly decrease the find
performance. Likely invisible on our modern CPU, but we need to remain mindful of the slimer specs such as old RPi 😄
We could also use a binary tree hash for more efficient matching, or even a bloom filter. Okay, I'm just joking now 😄 Converted the code to use
I originally wanted to implement |
On a more serious note, after thinking about parsing of the (And, vice versa, What do you think? |
The additionals modes have been introduced by Rapid Ecolution. See: |
I was looking at this some time ago and realise the search feature was actually quite complete! I think our UI doesn't give it good usability, but this is something as part of the new Mixxx design :)
I agree - I feel like search should allow you to use any key annotation. independently of the display preference. Searching for Alternatively, we could display a warning message and CTA to update the selected key notation in one click. Appreciate this may become a fairly large change, so happy to see this coming as part of a follow up PR if you would prefer! |
I think we can very much assume that the usere searches for the notation he also sees in the library. We just to need to be carefull to not mess with metadata read form the file tags. Here we can't use this assumption. |
Thanks! Googling for For future reference, this page contains a reference on what the "advanced" Lancelot modes actually mean:
|
Co-authored-by: Antoine Colombier <[email protected]>
9c4756d
to
6eee8ca
Compare
Yes, I think that this PR is good to go as-is (provided you also agree) as it's a 99.9% solution (because, although there is some infrastructure in place for parsing different scale modes like
The other table columns all use case-insensitive text matching of what the user can visually see, so its very reasonable for
I agree. My thought was that there should probably be two parsing modes:
The necessary infrastructure already seems to be in place for this, as e.g. |
Co-authored-by: Antoine Colombier <[email protected]>
6eee8ca
to
f9993b1
Compare
@cr7pt0gr4ph7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, thanks you!
I had a look at #14182, and it seems to me like I can't think of a good reason for why the search syntax should differ between Smarties/SmartCrates vs. the searchLineEdit (and for why that would not be really confusing for users). Given that assumption, I don't see why it shouldn't be possible possible to use |
When a user types in
key:5a
into the search field, the intent is most likely to search forkey:5A
instead of doing a text-only search.The only case where case-insensitive parsing is ambigous is for the
d/m
(OpenKey) andD/M
(Lancelot) suffixes, where lowercase will imply OpenKey, and uppercase will imply Lancelot (due to the order in whichguessKeyFromText
checks for matches with the different notations).