Page MenuHomePhabricator

๐Ÿ“„ Paginate simple search results
Closed, ResolvedPublic8 Estimated Story Points

Description

Request:
Add two query parameters:

  • limit - the number of items to show in the results (max: 500, default: 10)
  • offset - the index to start showing results from (default: 0)

Responses:

  • 200:
    • an array of search results, up to limit in size
  • 400:
    • the usual invalid-query-parameter if either query parameter is out of range

Notes:

  • If a user requests a page greater than the total amount of search result pages, we will return an empty list ([])
  • At this stage we will not indicate:
    • the total number of search results or the total number of pages of search results
    • the next and/or previous page of results

Task Breakdown notes:

subtasks:

  • Adjust the OpenAPI document
  • happy path for InLabelSearchEngine
  • happy path for SqlTermStoreSearchEngine
  • validation: limit needs to be a number between 1 and 500; offset needs to be a number >=0
    • rely on the REST framework's request parameter validation for type check
    • do validation of the parameter's range inside the use case, using the validator
    • 400 error response:
{
  "code": "invalid-query-parameter",
  "message": "Invalid query parameter: 'limit'",
  "context": {
    "parameter": "limit"
  }
}

Event Timeline

Jakob_WMDE renamed this task from Paginate simple search results to ๐Ÿ“„ Paginate simple search results.Apr 1 2025, 12:40 PM