User avatar
S7EWIE
Registered User
Registered User
Posts: 3
Joined: Sun Aug 17, 2014 5:43 pm
Country: Austria

API search result hits limiting

Tue Aug 26, 2014 5:58 pm

Hi,

I'm trying out the API using the testing API key and I noticed that the number of returned search results for a search pattern is limited to five. For example, here is a basic search for artists whose names start with "Ma", which should definitely return more than five results:
http://www.theaudiodb.com/api/v1/json/1/search.php?s=ma%25

So my question is:
Is this hits limiting to five a general API characteristic, or this is only a limitation of the testing API key?

Cheers,
S7EW

User avatar
zag
Site Admin
Site Admin
Posts: 1227
Joined: Wed Jun 06, 2012 9:19 am
Country: United Kingdom

Re: API search result hits limiting

Wed Aug 27, 2014 2:44 pm

Hey S7EWIE,

Thanks for testing the API. This is normal behaviour and is by design on all API keys currently.

The results should return all searches for "MA" on the artist name or artist alternate name sorted by the string length so it should be enough to accurately find any artists called MA or duplicates. Currently I doubt we have any artist names duplicated 5 times.

The reason for only returning 5 is we serve around 4 million API hits a night and any increase in in results is multiplied by 4 million :D

Saying all that, its not a problem to increase the results for a specific API key. Just apply for one and let me know how many you wish to be returned.

Let me know ;)

User avatar
S7EWIE
Registered User
Registered User
Posts: 3
Joined: Sun Aug 17, 2014 5:43 pm
Country: Austria

Re: API search result hits limiting

Wed Aug 27, 2014 8:48 pm

Hi zag,

First of all, thanks for the fast reply. Second, thanks for all the effort on TADB ;) !

Now, back on topic. I fully understand your decision to limit the number of returned results in order to safeguard performance. I'm also happy to hear that the result limiting can be configured on a per-API key basis (I will soon apply for a key). Nevertheless, for supporting another possible use-case for TADB, I would have a suggestion for the next API update (fully backwards compatible).

Use-case Description
What if users could use TADB for something other than scraping? With scraping you usually have an exact artist/album/track name, therefore as you said 5 results are more than enough. Alternatively, TADB could be used say for searching based on human (typed) input which is often inexact and often incomplete. In short, the additional scenario would be "using TADB for discovering new content for the user" rather than "using TADB for identifying the content the user already has".

API Extension Proposal
What about adding an additional query parameter to your php pages to allow the user to configure the maximum number of returned results? Of course, the per-API key limiting will still be in effect.

For example, let's assume the API key "X", with a maximum number of returned results set by you at 100 results. The (fair) user, will then be allowed through the new parameter to restrict the number of returned results even further.

Concrete example:

http://www.theaudiodb.com/api/v1/json/X/search.php?s=ma%25
would return up to 100 results of artists whose names/alt names started with "ma".

http://www.theaudiodb.com/api/v1/json/1/search.php?s=ma%25&l=20
would return up to 20 results of artists whose names/alt names started with "ma".

Of course, this would be just a first step towards supporting the presented use-case. One could think of Soundex fuzzy queries...

Please excuse the verbosity; old habits (die hard). Thanks for the support.

Return to “Developers”