python-musicbrainzngs icon indicating copy to clipboard operation
python-musicbrainzngs copied to clipboard

Special characters escaping doesn't supported properly by API

Open nickmasster opened this issue 8 years ago • 0 comments

Although MusicBrainz claims it using Lucene text search engine, it doesn't support special characters escaping properly as described in Lucene documentation.

It leads to an issue when you trying to use wildcard search (* or ?) and API doesn't return any results when it definitely should.

For example, I'm trying to search for artist called "Nirvana" using query "nirv*".

Library escapes all Lucene special characters as described in documentation, and I got following query string: artist%3A%28nirv%5C%2A%29 which after URL decode looks like artist:(nirv\*).

Unfortunately, got an empty result from an API.

But when disabling special characters escaping, the generated query looks like artist%3A%28nirv%2A%29 (after URL decode: artist:(nirv*)) and I received a list of 19 artists.

Also, when using strict mode, even after disabling escaping for wildcard characters, it doesn't work properly because of double quotes that every query value is wrapped by.

An advantage of strict mode is support of AND and OR logical operators between multiple search parameters. But it shouldn't prevent from using wildcards in search query.

nickmasster avatar Aug 27 '16 17:08 nickmasster