Release Search

How can i get release result when i search by release title and artist name together?
like: “neil young harvest” i want the result as release “harvest” having artist " niel young". How can i get it by api? In my case i am getting 0 result with this string.

2 Likes

if you are asking about musicbrainz search
you can only search for one or the other so if your looking for the album for one or the other. so if the release is called harvest you can search in release or release group for harvest . if the artist is niel young you search under artist for niel young. you can not put harvest niel young or niel young harvest in either search.

1 Like

so why this url giving me results:

https://musicbrainz.org/search?query=niel+young+harvest&type=release&method=indexed

when i do normal search .

It would help if you would tell us what query you tried which gives you no results. It’s hard to answer why something is failing when you don’t know what it is :wink:

But something like this should work if you are just after the albums:

https://musicbrainz.org/ws/2/release-group/?query=niel+young+harvest

Or the same for actual releases:

https://musicbrainz.org/ws/2/release-group/?query=niel+young+harvest

Of course you can further refine these queries, e.g. by limiting it by primarytype. Have a look at the docs at https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search

4 Likes

Hey, look this api response
https://musicbrainz.org/ws/2/release/?query=niel+young&fmt=json

and when i do same search on musicbrainz site the response will be different.
https://musicbrainz.org/search?query=neil+young&type=release&method=indexed

this is what, where i am getting confused. Why am i getting two different result with same search string “neil young” by release.

Check the spelling on your API query.

2 Likes

okay sorry for that.

https://musicbrainz.org/search?query=neil+young+harvest&type=release&method=indexed

https://musicbrainz.org/ws/2/release/?query=neil+young+harvest&fmt=json&method=indexed

what about these two.

Try it like this…

https://musicbrainz.org/ws/2/release/?fmt=json&query=artist%3A"Neil+Young"+AND+release%3A"Harvest"

1 Like

thanks for the reply, but i can’t use this query as in my case i am not aware about artist and release as user can enter only a string “neil young harvest” and i have to show him the result as we are getting in musicbrianz search. when we search this string as release in music brainz search we get first listing of “Harvest” release having artist “neil young”.

so please let me know if it possible to search that release in my case where i haven’t any info about release title or artist name.

https://musicbrainz.org/search?query=neil+young+harvest&type=release&limit=25&method=indexed

https://musicbrainz.org/ws/2/release/?query=neil+young+harvest&fmt=json&method=indexed

The corresponding UI search for the API search you showed would be:

https://musicbrainz.org/search?query=neil+young+harvest&type=release&limit=25&method=advanced

And this gives the same result as the API search:

https://musicbrainz.org/ws/2/release/?query=neil+young+harvest&fmt=json

Searching for "neil+young"+harvest would give better results.

Also as you previously showed the “indexed” search for UI searches, according to the API search docs you can set dismax=true:

This is equivalent to switching from the “Indexed search with advanced query syntax” method to the plain “Indexed search” method on the website. Defaults to “false”.

So if your goal is to get exactly the results of an indexed search use:

https://musicbrainz.org/ws/2/release/?query=neil+young+harvest&fmt=json&dismax=true

Edit: Reading the Solr docs about dismax this is really what you want:

In general, the DisMax query parser’s interface is more like that of Google than the interface of the ‘standard’ Solr request handler. This similarity makes DisMax the appropriate query parser for many consumer applications. It accepts a simple syntax, and it rarely produces error messages.

See https://lucene.apache.org/solr/guide/6_6/the-dismax-query-parser.html

4 Likes

wow, that’s what exactly i was searching. Thank you so much. You made my day.:love_you_gesture:

1 Like

is sorting available in musicbrianz api?
like i want to get releases sorted by date(earlier first) and so on…

as for now there are only two options limit and offset. please tell if anyother pagefilter options availbale in api.

Sorting is not available, and there is no other paging option.

1 Like