Querying for empty fields

Tags: #<Tag:0x00007fe3183e5000> #<Tag:0x00007fe3183e4c18> #<Tag:0x00007fe3183e49e8> #<Tag:0x00007fe3183e46f0> #<Tag:0x00007fe3183e4510>

I’m using MusicBrainz’ API to query for new releases. In order to slim down the results, I’m only gathering results with country codes US (Unites States) and XW (Worldwide). However, this week, Code Orange had a release that didn’t show up because their realease didn’t have a country code added. How would I go about searching for only releases that have no country code?

I believe (can’t test it right now) that empty fields can be searched for by specifying - as the value.

That’s what I thought as well, but after reading the docs too many times, I finally came across this (which can be found here):

When searching fields that come from a defined set of possible values such as country and gender, find matches where these fields have not been set by searching for unknown.

Example: http://musicbrainz.org/ws/2/release/?query=country:unknown

This works well, but for some reason when I chain it with a query that has a range (i.e. release date range), it produces 0 results.

For example this works: http://musicbrainz.org/ws/2/release/?query=date:[2016-01-01%20TO%202017-01-01]%20AND%20country:XW

But this doesn’t: http://musicbrainz.org/ws/2/release/?query=date:[2016-01-01%20TO%202017-01-01]%20AND%20country:unknown

Any suggestions as to why?

1 Like

Here is the project I’m trying to solve this query for: The Rthm - New Releases

Interestingly enough, I was missing a release this week because it didn’t have a format value, so I adjusted my query to include releases that don’t have a format (format:"Digital Media" OR format:\-), and it works just fine. Is there maybe just a bug with country field?

Thanks to your own solution in another topic, here would be the solution here: NOT country:/.*/