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

Incorrect search results #4

Closed
fatg3erman opened this issue Aug 15, 2013 · 3 comments
Closed

Incorrect search results #4

fatg3erman opened this issue Aug 15, 2013 · 3 comments
Assignees
Labels
C-bug Category: This is a bug

Comments

@fatg3erman
Copy link

The search results are a little strange.

Using the mpd frontend,
'search artist "Can"'
returns all tracks with 'can' in them - either the artist name, album name, or track name. This might just be a limitation of beets I think but can you confirm this?

Using the Mopidy HTTP frontend however, I get unusual results -
mopidy.library.search({artist: 'Can'}, ['beets:'])
returns an object with a uri property of 'beets:search-C', which contains every artist beginning with 'A', 'B', or 'C'.

Mopidy 0.14.2 (Ubuntu ppa), and the latest beets and mopidy-beets installed from pip (yesterday).

@fatg3erman
Copy link
Author

Apologies, I was doing it wrong :) A quick perusal of the code revealed that I should be doing:
mopidy.library.search({artist: ['Can']}, ['beets:'])

@fatg3erman
Copy link
Author

I'm reopening this because I found that the search results can be improved. Searching the way I put in my second comment does limit the results to 'Can' but it still returns every file which has the letters 'Can' in any metadata field, which is not too useful.

I've edited library.py to format the artist, album, track, and year queries according to the way the beet CLI tool does it:

        for (field, val) in query.iteritems():

            if field == "album":
                search.append('album:'+val[0])
            if field == "artist":
                search.append('artist:'+val[0])
            if field == "track":
                search.append('track:'+val[0])
            if field == "date":
                search.append('date:'+val[0])

This gives the results I'd expect.
You can still use mopidy's 'any' field to enter any generic search - eg year:2002

@sumpfralle
Copy link
Contributor

thank you for your hint!
Now the search code should work fine for the different categories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

2 participants