Query missing results that appear in site search


I’m still working on my app for creating NFO files for Kodi music videos. I thought I had everything done when I started to run into problems with the query API returning differnt results than a standard MusicBrainz search. I’m using the same criteria as a previous topic where I’m searching for Whitney Houston’s “I Wanna Dance With Somebody (Who Loves Me)”. This is the query I’m using:

https://musicbrainz.org/ws/2/recording?query="i wanna dance with somebody (who loves me)" AND artist:"whitney houston"&fmt=json

This nets me 59 results. The problem is the recording I need, from the album “Whitney”, doesn’t appear.

The MusicBrainz search engine finds it fine with:


which returns 175 results and the album is on page 2.

So I adapted my query to use the same encoding:


which also returns 175 results, but not the same ones and is still missing the album “Whitney” and the recording 900c26eb-e3a4-481d-9c3b-dd8963a7c185

Since the documentation implies using query is the same as the regular MusicBrainz website search I’m at a loss.

Any advice would be greatly appreciated as TheAudioDB.com MusicBrainz IDs are often wrong and I’d prefer to get results directly from MusicBrainz.


API search results like the website search are paginated. Use the offset parameter to get the remaining pages

But for the moment the pagination is broken (confirmed for works, recordings and release groups):

There is a fix pending:

In the meantime you can set a limit=100 and hope you don’t have more than 100 results.


Hi Chris!

You have to escape the parentheses in your query as these are special characters in Lucene search syntax which is linked from Indexed Search Syntax - MusicBrainz.


https://musicbrainz.org/ws/2/recording?query="i wanna dance with somebody \(who loves me\)" AND artist:"whitney houston"&limit=100&fmt=json


https://musicbrainz.org/search?query="i wanna dance with somebody \(who loves me\)" AND artist:"whitney houston"&type=recording&limit=100&method=advanced

return 59 results with the recording 900c26eb-e3a4-481d-9c3b-dd8963a7c185.



Hey Yvan!

You’re awesome :grinning:. I gotta say it’s weird that using \( and \) works but %28 and %29 do not in the API when that encoding does work in the site search. Also I don’t understand why not including &limit=100 produces different results (as in your version without &limit=100 also returns 59 results but without the album “Whitney” ones).

I’m not gonna complain but I have to ask are there any other characters I should escape when using query= or is there a page that documents this necessity?

Thanks so much,

This issue is related to sorting. See the above explanation by @jesus2099. There is some work in progress to address it, but no expected time of arrival can be given.

Those characters are + - && || ! ( ) { } [ ] ^ " ~ * ? : \ / as listed in the linked Lucene documentation page. Admittedly, advanced search is austere for now.

1 Like