1

I have a search functionality that gets data from HERE API's Search endpoint. I maintain records of each search's results so I can add metadata that I need for my own purposes and also so I can provide results without always going back to HERE API. The problem I have is with paginating, specifically with providing a starting index when fetching results from HERE. Similar to how Algolia does it, I want to be able to search for a term and begin with the results at a certain index, the offset. HERE API apparently doesn't allow this at all. The closest it comes to such a feature is that it provides the URL for the next search, as described here. This is limited because it doesn't allow me to start the search results at a particular index that I specify. So essentially I want to know if there's a "standard" way of getting such functionality even when it's not provided by the API.

My own solution

The HERE API provides a size parameter that allows specifying the total number of results that I want, so I can specify a larger size than I need, and basically use code to start the results from my desired index. But this feels a bit hacky, and I wonder if there's a better/more established way of doing this.

Happy to listen to any ideas! Thanks. :)

Uche Ozoemena
  • 816
  • 2
  • 10
  • 25
  • I'm confused - if the API provides a way to get the next page, isn't that all you need? Or are you saying you want to "skip" a page? – Raymond Camden Sep 14 '20 at 13:33
  • I want to skip any number of results and start the pagination from that point. So if I get 100 results per page and I want to start from the 37th result, I want to say `offset: 37`, so the first page would then be results 37 to 136. That's what I mean. – Uche Ozoemena Sep 14 '20 at 15:07
  • Ah ok. So yeah, I think you are out of luck in that regards. Obviously you could still display 37-137. Just ensure you get enough to fufil the need. Like if it's 100 per call, you can do 2 calls. It's slightly wasteful, but as you said, you're also storing results. – Raymond Camden Sep 14 '20 at 19:18

1 Answers1

1

Such a kind of an 'offset' for starting the paging after a specific number of results is indeed not supported by the Places API itself. You have to set up a workaround within your application.