-
-
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
SearchQueryParser: Add "OR" search operator #12061
Conversation
2b236ba
to
e3d9b14
Compare
e3d9b14
to
4abc9e6
Compare
Clazy seems to prefer this
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.
Thank you. Can you also ass a test for this?
I've updated the parser to handle quotes correctly (i.e. |
02912b6
to
93b96bc
Compare
I don't understand why the tests are failing in CI, they work on my machine™. Off all the tests, |
Couldn't reproduce the test failure in an Arch Linux Docker container, neither on arm64 nor on x86_64. |
Ah, I see, CI ran into a debug assert which I didn't get since I was building in
mixxx/src/library/searchquery.cpp Lines 125 to 132 in 9e411ff
Might be an interesting question how we should handle this. Apart from the top-level |
I think we should consider the intermediate results when typing. I can imagine that showing nothing because of a semantic error feels bad. Is this related here? I have not tested. What happen if you type "ABBA |" ? The other issue is that we should only assert impossible conditions. Sincea user can trigger it, it must not be an assertion. |
Empty children are currently filtered out, so this would be equivalent to simply typing mixxx/src/library/searchqueryparser.cpp Lines 292 to 296 in 93b96bc
The only real edge case where the user would end up with an empty I'd be fine with specifying the empty OR as meaning "match everything", even if it deviates from the common convention to define it as "match nothing" if that makes SQL generation more convenient and/or lines up with what the user expects (i.e. still showing all tracks, when the query is The (logically sound) alternative would be to define the empty OR as matching nothing and emit We should remove this debug assert either way. Wdyt? |
I think we should support both! |
This is consistent with boolean logic and will generally only show up in edge cases to the user (e.g. when the search query consists of an empty OR operator, i.e. `|`)
@JoergAtGithub I've had a go at that, but parsing it seems to be less trivial than I would've hoped for, particularly the tests around literal |
Both Additionally, I have implemented the empty-OR-as-false interpretation, which essentially amounted to removing the debug assert and generating |
885595c
to
c753ebe
Compare
c753ebe
to
adad086
Compare
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.
This works like a charm now and the code LGTM as well.
Special thanks for the extra efforts in testing.
Thanks for implementing my 6 year old feature request. |
I'm wondering: i don't spot any changes to user-facing strings (tr), what was the reason to target 2.5 instead of 2.4? |
My general philosophy was to target |
Fixes #8881
This adds
|
and (uppercase)OR
as syntax for the OR operator in search queries. Thus queries such ashouse | disco
or equivalentlyhouse OR disco
will now yield the combined results from queryinghouse
anddisco
.Both
|
andOR
have strong precedent, e.g. with Google using these operators1. Especially|
is terse, easy to read/write and familiar to technical users.Footnotes
https://ahrefs.com/blog/google-advanced-search-operators ↩