Search code examples
musicbrainz

Can't find track from artist and title name


I am experimenting with the musicbrainz api using NodeJs. I want to get the track info of a specific track. I can do it with ISRC but if I try to search it with artist and title name, i get the wrong results.

For Example: Artist = Aphrodite's Child, Title = It's five o'clock

URL: https://musicbrainz.org/ws/2/recording/?query=recording:It%27s%20five%20o%27clock&artist:Aphrodite%27s%20Child&fmt=json&inc=

This doesn't return the right results although I know that this song is in the database.


Solution

  • & (a single ampersand) does not combine multiple search criteria like you'd expect. The Lucene search syntax description, which the MusicBrainz search docs link to, say:

    AND

    The AND operator matches documents where both terms exist anywhere in the text of a single document. This is equivalent to an intersection using sets. The symbol && can be used in place of the word AND.

    Either https://musicbrainz.org/ws/2/recording/?query=recording:It%27s%20five%20o%27clock%20%26%26%20artist:Aphrodite%27s%20Child&fmt=json&inc= (two ampersands, escaped as %26) or https://musicbrainz.org/ws/2/recording/?query=recording:It%27s%20five%20o%27clock%20and%20artist:Aphrodite%27s%20Child&fmt=json&inc= (the keyword and) work.

    Another note: searches via the MusicBrainz API do not support the inc parameter, include lookups and browse requests do.