mopidy-spotify icon indicating copy to clipboard operation
mopidy-spotify copied to clipboard

Searching for exact matches

Open kingosticks opened this issue 10 years ago • 6 comments

When using MPD's find command the results are supposed to be an exact match of the query but due to limitations in Spotify's searching you actually get partial matches more akin to SQL's LIKE operator.

e.g. Searching for "Opposite of December" gives you results from two albums:

  • "Opposite of December"
  • "The Opposite Of December / Tear From The Red"

This is pretty annoying when you browse an artist's album in MPD clients and get wrong and duplicate tracks entries.

I know of no way to force exact matching in Spotify queries so maybe we could further filter the results returned to us in find_exact()? Similarly, we could also filter by the fields that Spotify queries don't support i.e. track_no. The motivation for this being that much larger amounts of data are returned to the client than are necessary and it just slows things down. This also combines with the first problem and you can get the full track info for loads of unwanted tracks!

kingosticks avatar Jan 07 '14 23:01 kingosticks

Agree! Should do this differently for the upcoming Mopidy-Spotify 2.0.

jodal avatar Jan 07 '14 23:01 jodal

Do you think there is any merit in doing this in pyspotify 2.0? At least the exact searches bit.

I vaguely remember the mention of an additional higher-level wrapper that did some extra useful stuff (I think this was based around the bug where starred playlists have no name),

kingosticks avatar Jan 07 '14 23:01 kingosticks

It's worth considering at least. The immediate issue I can think of is how to make an "exact match" overlay over the existing search work nicely with pagination. If you search for "foo" and ask for 20 results, then you're told that "we found 73 results, here's the first 20" and then there's only 18 in the result, since two wasn't exact matches.

jodal avatar Jan 09 '14 08:01 jodal

mopidy/mopidy#272 seems relevant here. We should consider using artist/albumbrowse instead of or in addition to search for find_exact.

trygveaa avatar May 16 '14 18:05 trygveaa

To move the entire discussion over here, I'm quoting @trygveaa from mopidy/mopidy#272:

We can first do a search for the query provided. Then traverse either the artist or album results, depending on what the query contained, to find the one that matches exactly (this means that searches will have to be able to return artists and albums, as discussed in #285). At last we do a lookup of the artist or album to retrieve all the tracks.

The benefits of this vs. a normal search:

  • We are able to retrieve all the tracks from the artist or album, not just a matching subset of the max number of tracks returned by searches.
  • We won't have to do any filtering.

The disadvantage:

  • We have to do two queries to Spotify.

jodal avatar Sep 08 '14 18:09 jodal

From the discussion in mopidy/mopidy#727 it sounds like making exact searches exact would help on data quality in the ncmpcpp library view as well.

jodal avatar Sep 08 '14 18:09 jodal