/search endpoint returning wrong number of results.

Avatar image for hogonalog
hogonalog

20

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#1  Edited By hogonalog

Don't know if this is the right place for this, so please correct me if I'm wrong.

When making requests to the /search endpoint, the length of the results array is incorrect when searching multiple resources. It seems to be applying the {limit} param to each individual resource instead of the aggregate result set.

This request returns 10 results (only searching games):
http://api.giantbomb.com/search?query=mass&resources=game&limit=10&format=json&api_key=[API_KEY]

This request returns 20 results (searching games and people):
http://api.giantbomb.com/search?query=mass&resources=game,person&limit=10&format=json&api_key=[API_KEY]

This request returns 53 results (searching everything):
http://api.giantbomb.com/search?query=mass&limit=10&format=json&api_key=[API_KEY]

I don't know if this is expected behaviour, but it seems incorrect.

Avatar image for jslack
jslack

1186

Forum Posts

1165

Wiki Points

0

Followers

Reviews: 1

User Lists: 6

@hogonalog: Thanks for reporting.

It is indeed adding a limit to each resource, since they are all queried separately. It's really difficult to have a global limit that will work with intended results otherwise. Basically, I'd rather provide more data than less data.

I'm taking a look anyway to see if there's anything we can do

Avatar image for hogonalog
hogonalog

20

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#3  Edited By hogonalog

Thanks for the reply, it's an understandable problem with the volume and variety of data you guys manage.

I was concerned with paginating results. Each resource can return different amounts of total results, so page 1-5 may have max 20 results, but page 6+ may only have 10. That means you can't build a reliable paginator.

It may also be problematic for single-page result sets (autocomplete, related items). Items with higher relevance could be pushed down to the bottom of the set because of their resource type. But I imagine searching multiple resources is pretty rare.

Anyways, thanks for looking in to it!