Querying for empty fields

release-country
search
regex
api
musicbrainz
Tags: #<Tag:0x00007f2a092361c8> #<Tag:0x00007f2a09236010> #<Tag:0x00007f2a09235e80> #<Tag:0x00007f2a09235d40> #<Tag:0x00007f2a09235b88>

#1

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?


#2

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


#3

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?


#4

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?


#5

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