Page MenuHomePhabricator

Take apihighlimits into account for REST prefix search
Closed, ResolvedPublic

Description

/suggest/items and /suggest/properties are the REST API equivalents of wbsearchentities in the Action API. wbsearchentities has a maximum page size (limit) of 50 results for basic users, and 500 for users with the apihighlimits right. For /suggest, the maximum limit is 500 for all users.

This difference seems strange from the user perspective and also makes the underlying code unnecessarily complicated. We should consider applying the same limits to both.

AC:

  • Limits are consistent with what is currently being done in the Action API

Task Breakdown Notes:

  • check if the user has the apihighlimits right inside the use case validator (ItemPrefixSearchValidator)
    • get the user name from request context in the route handlers (Item/PropertyPrefixSearchRouteHandler), see CRUD route handlers
    • pass the username as part of the request object (ItemPrefixSearchRequest) into the use case (ItemPrefixSearch)
    • transform user name string into user domain object (User) in the use case
    • use case validator determines apihighlimits right for the user from its domain model (via newly created PermissionChecker)
      • create a new PermissionChecker Domain Service (interface) with method hasApiHighLimits()
      • implement PermissionChecker in the Infrastructure layer

Event Timeline

Change #1298883 had a related patch set uploaded (by Kim.pham; author: Kim.pham):

[mediawiki/extensions/Wikibase@master] REST: Adjust prefixsearch max for apihighlimits

https://gerrit.wikimedia.org/r/1298883

Change #1303964 had a related patch set uploaded (by Kim.pham; author: Kim.pham):

[mediawiki/extensions/Wikibase@master] Search: Also pass User through SearchEntities to use cases

https://gerrit.wikimedia.org/r/1303964

Change #1298883 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] REST: Adjust prefixsearch max for apihighlimits

https://gerrit.wikimedia.org/r/1298883

Change #1303964 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Search: Also pass User through SearchEntities to use cases

https://gerrit.wikimedia.org/r/1303964