mikealmond / MusicBrainz

A PHP library to access MusicBrainz's Web Service v2
http://musicbrainz.org/doc/Development
MIT License
64 stars 26 forks source link

search query parameters #7

Closed shrddr closed 10 years ago

shrddr commented 10 years ago

when searching for something like this: $brainz->search(new ReleaseFilter(array("artist" => "John Scofield")));

there are lots of weird results by artists "John John", "John St. John", "DJ John John", etc.

that's because the query is: http://musicbrainz.org/ws/2/release/?fmt=json&query=artist:John%20Scofield

which according to Lucene query syntax performs a search for 'artist:John OR release:Scofield'. that's totally unexpected and is not indicated in any way by ReleaseFilter syntax.

in order to get reasonable search results parameters should be double quoted: (http://musicbrainz.org/ws/2/release/?fmt=json&query=artist:"John%20Scofield")

alternatively, it can be achieved by appending field name to every word: http://musicbrainz.org/ws/2/release/?fmt=json&query=artist:John%20AND%20artist:Scofield

mikealmond commented 10 years ago

This has been fixed in the develop branch. https://github.com/mikealmond/MusicBrainz/blob/develop/src/MusicBrainz/Filters/AbstractFilter.php#L67-72

mikealmond commented 10 years ago

Merged into master