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

Exact phrase search not working. #3974

Closed
spaceb0b opened this issue Jun 8, 2021 · 2 comments
Closed

Exact phrase search not working. #3974

spaceb0b opened this issue Jun 8, 2021 · 2 comments

Comments

@spaceb0b
Copy link

spaceb0b commented Jun 8, 2021

Problem description

I have the following two albums in my library: "Son of Morris On" and "Great Grandson of Morris On". According to the phrases section of the queries chapter from the documentation it should suffice to use beet list -a "Son of Morris On" to find the first album. However the command returns both the albums mentioned above. I guess this is a problem because the former album can be considered a substring of the latter (ignoring capitalization). Modifying the command to beet list -a album:"Son of Morris On" gives the same result. Using regex works as intended though: beet list -a album::"Son of Morris On" returns only the former album. However the same regex query doesn't work with the modify command beet modify -a album::"Son Of Morris On" albumartist="Ashley Hutchings", it notifies me that no matching album is found.

Update: regex does work with the modify command. I just made the error of using "Of" instead of "of". It's still not clear if the list command works as intended regarding phrases.

Setup

  • OS: Windows 7 (don't judge)
  • Python version: 3.7
  • beets version: 1.4.9
  • I tried turning off plugins, and that made the problem go away (yes/no): no because I don't think it's related to plugins.

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    auto: yes
    bing_client_secret: REDACTED
    bing_lang_to:
    google_API_key: REDACTED
    google_engine_ID: REDACTED
    genius_api_key: REDACTED
    fallback:
    force: no
    local: no
    sources:
    - google
    - lyricwiki
    - musixmatch
    - genius
directory: F:\Music\Library
library: F:\Music\Database\library.db
pluginpath: ['C:\Users\REDACTED\AppData\Local\Programs\Python\Python37\Lib\site-packages']

plugins: lyrics play duplicates fuzzy missing random extrafiles types check usertag inline acousticbrainz spotify edit discogs fetchart

import:
    move: no
    write: no
    autotag: yes
    log: beetlog.txt
    bell: yes
    per_disc_numbering: no

    clutter: Thumbs.DB .DS_Store .m3u .torrent .pls .log
    threaded: yes

ui:
    color: yes
    text_success: green
    text_warning: yellow
    text_error: red
item_fields:
    multidisc: 1 if disctotal > 1 else 0

paths:
    default: '%asciify{$albumartist}/%title{%asciify{$album}} ($year) [$format] %aunique{}/%if{$multidisc, CD$disc/}$track - %asciify{$title}'
    singleton: Non-Album/$artist/%asciify{$title}
    compilations: Compilations/%title{%asciify{$album}} ($year) [$format] %aunique{}/$track - %asciify{$title}
fetchart:
    cover_names: cover folder
    auto: yes
    minwidth: 0
    maxwidth: 0
    enforce_ratio: no
    cautious: no
    sources:
    - filesystem
    - coverart
    - itunes
    - amazon
    - albumart
    google_key: REDACTED
    google_engine: 001442825323518660753:hrh5ch1gjzm
    fanarttv_key: REDACTED
    store_source: no

match:
    strong_rec_thresh: 0.1
    distance_weights:
        source: 2.0
        artist: 3.0
        album: 3.0
        media: 1.0
        year: 1.0
        album_id: 5.0
        tracks: 2.0
        track_title: 3.0
        track_id: 5.0
play:
    command: foobar2000
    bom: yes
    use_folders: no
    relative_to:
    raw: no
    warning_threshold: 100
duplicates:
extrafiles:
    patterns:
        all: '*.*'

    paths: {}
types:
    rating: int
    favorite: bool
check:

    import: yes
    write-check: yes
    write-update: yes
    thread: 4
    integrity: yes
    convert-update: yes
    threads: 8
    external:
        mp3val:
            cmdline: mp3val {0}
            formats: MP3
            error: '^WARNING: .* \(offset 0x[0-9a-f]+\): (.*)$'
            fix: mp3val -nb -f {0}
        flac:
            cmdline: flac --test --silent {0}
            formats: FLAC
            error: '^.*: ERROR,? (.*)$'
        oggz-validate:
            cmdline: oggz-validate {0}
            formats: OGG
missing:
    format: $albumartist - $album - $track - $title
    count: no
    total: no
    album: no
spotify:
    mode: list
    tiebreak: popularity
    show_failures: no
    artist_field: albumartist
    album_field: album
    track_field: title
    region_filter:
    regex: []
    client_id: 4e414367a1d14c75a5c5129a627fcab8
    client_secret: REDACTED
    tokenfile: spotify_token.json
    source_weight: 0.5
discogs:
    apikey: REDACTED
    apisecret: REDACTED
    tokenfile: discogs_token.json
    source_weight: 0.5
    user_token: REDACTED
acousticbrainz:
    auto: yes
    force: no
    tags: []
pathfields: {}
album_fields: {}
fuzzy:
    prefix: '~'
    threshold: 0.7
edit:
    albumfields: album albumartist
    itemfields: track title artist album
    ignore_fields: id path

@wisp3rwind
Copy link
Member

I have the following two albums in my library: "Son of Morris On" and "Great Grandson of Morris On". According to the phrases section of the queries chapter from the documentation it should suffice to use beet list -a "Son of Morris On" to find the first album. However the command returns both the albums mentioned above. I guess this is a problem because the former album can be considered a substring of the latter (ignoring capitalization).

I don't think the documentation describes a different behaviour (it might be possible to improve the example). It is talking about shell argument parsing, i.e. beet list the rebel will generate two separate matchers for "the" and "rebel", so the matches don't need to be adjacent, whereas beet list "the rebel" will only match "the rebel", not anything that contains both words.

Using regex works as intended though: beet list -a album::"Son of Morris On" returns only the former album.

The regex is case-sensitive, while the "regular" query is not.

I guess the solution here is to use regex queries or explicitly match multiple fields (as you did with the albumartist) when you need to match something very specific.

@spaceb0b
Copy link
Author

spaceb0b commented Jun 8, 2021

I see, then perhaps it was just confusion on my part. Thanks for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants