lundi 9 avril 2018

Implement paging support with additional filtering from backend data source

We have an API exposed as REST service with backend calls to Azure Search, everything works well, except that when the paging support comes in play.

Example scenario,

  • front end request a page size of 100 with filter condition of department=sales
  • the API calls Azure Search with the filter condition
  • the API then filter the fetched data with additional condition before return the dataset

The challenge now is requested data set size could be smaller than the requested window size.

Resolution we were thinking

  1. Have the API return some sort of http code that means 'additional data available' when the requested window size is greater than the filtered dataset size, the frontend then keep calling the API until the API return a status code of 200
  2. Have the API to keep calling the Azure Search until the requested window size is matched

Thought? any best practice pattern to implement this requirement? Thanks

Aucun commentaire:

Enregistrer un commentaire