tiagopog/jsonapi-utils

Trying to override pagination...

adambedford opened this issue · 0 comments

I'm overriding the index action on one of my API endpoints to support searching with Elasticsearch and I need to also paginate with ES but I'm running into an issue. On page 2 (and likely 3,4, etc), jsonapi_render returns an empty dataset even though the collection passed to it contains records. I have a suspicion this is related to pagination - perhaps JR or JU is expecting the collection passed to jsonapi_render to be the full recordset, and then it applies pagination, whereas in my case the collection passed is already paginated because it came from ES.

Is there a way to turn off pagination inside a controller action? I can't go so far as to disable pagination on the resource because the index action needs to behave as normal as well.