mirror of
https://github.com/beetbox/beets.git
synced 2026-01-30 12:02:41 +01:00
Change the prefix for exact match queries
PR #4251 added exact match queries, which are great, but it was subsequently pointed out that the `~` query prefix was already in use: https://github.com/beetbox/beets/pull/4251#issuecomment-1069455483 So this changes the prefix from `~` to `=~`. A little longer, but hopefully it makes the relationship to the similarly-new `=` prefix obvious.
This commit is contained in:
parent
e995019edd
commit
f71e503f6c
3 changed files with 12 additions and 8 deletions
|
|
@ -1387,7 +1387,7 @@ def parse_query_parts(parts, model_cls):
|
|||
# Get query types and their prefix characters.
|
||||
prefixes = {
|
||||
':': dbcore.query.RegexpQuery,
|
||||
'~': dbcore.query.StringQuery,
|
||||
'=~': dbcore.query.StringQuery,
|
||||
'=': dbcore.query.MatchQuery,
|
||||
}
|
||||
prefixes.update(plugins.queries())
|
||||
|
|
|
|||
|
|
@ -25,7 +25,9 @@ New features:
|
|||
* :doc:`/plugins/kodiupdate`: Now supports multiple kodi instances
|
||||
:bug:`4101`
|
||||
* Add the item fields ``bitrate_mode``, ``encoder_info`` and ``encoder_settings``.
|
||||
* Add query prefixes ``=`` and ``~``.
|
||||
* Add :ref:`exact match <exact-match>` queries, using the prefixes ``=`` and
|
||||
``=~``.
|
||||
:bug:`4251`
|
||||
* :doc:`/plugins/discogs`: Permit appending style to genre
|
||||
* :doc:`/plugins/convert`: Add a new `auto_keep` option that automatically
|
||||
converts files but keeps the *originals* in the library.
|
||||
|
|
|
|||
|
|
@ -93,15 +93,17 @@ backslashes are not part of beets' syntax; I'm just using the escaping
|
|||
functionality of my shell (bash or zsh, for instance) to pass ``the rebel`` as a
|
||||
single argument instead of two.
|
||||
|
||||
.. _exact-match:
|
||||
|
||||
Exact Matches
|
||||
-------------
|
||||
|
||||
While ordinary queries perform *substring* matches, beets can also match whole
|
||||
strings by adding either ``=`` (case-sensitive) or ``~`` (ignore case) after the
|
||||
field name's colon and before the expression::
|
||||
strings by adding either ``=`` (case-sensitive) or ``=~`` (ignore case) after
|
||||
the field name's colon and before the expression::
|
||||
|
||||
$ beet list artist:air
|
||||
$ beet list artist:~air
|
||||
$ beet list artist:=~air
|
||||
$ beet list artist:=AIR
|
||||
|
||||
The first query is a simple substring one that returns tracks by Air, AIR, and
|
||||
|
|
@ -112,16 +114,16 @@ returns tracks by AIR only.
|
|||
|
||||
Exact matches may be performed on phrases as well::
|
||||
|
||||
$ beet list artist:~"dave matthews"
|
||||
$ beet list artist:=~"dave matthews"
|
||||
$ beet list artist:="Dave Matthews"
|
||||
|
||||
Both of these queries return tracks by Dave Matthews, but not by Dave Matthews
|
||||
Band.
|
||||
|
||||
To search for exact matches across *all* fields, just prefix the expression with
|
||||
a single ``=`` or ``~``::
|
||||
a single ``=`` or ``=~``::
|
||||
|
||||
$ beet list ~crash
|
||||
$ beet list =~crash
|
||||
$ beet list ="American Football"
|
||||
|
||||
.. _regex:
|
||||
|
|
|
|||
Loading…
Reference in a new issue