Page MenuHomePhabricator

(MS 5) limit the number of results
Closed, ResolvedPublic

Description

As an editor I want to be able to limit the number of results in my query in order to ensure it can be executed without hitting the query service time-out limit.

Problem:
The query service can not execute arbitrarily complex queries and stops a query if it takes longer than 60s to execute. One popular way to optimize queries is to limit the number of results in the result set. We need to allow people to do this in the query builder.

mockups:

image.png (692×912 px, 62 KB)

mock with error
mock with placeholder (when field empty)

BDD
GIVEN a visual query
WHEN the option to limit the results is checked
AND a result size of X is specified
THEN the result set only contains max. X results

Acceptance criteria:

  • queries take into account the limit set by the person building the query
  • when entering anything else other than a number, the field shows an error message (=> validation will probably not be implemented, as most likely a number input component or more advanced input will replace the current implementation. More info This ticket should be moved to "Blocked" at this point)
  • when removing the number, the placeholder appears ("enter a number")
  • when running the query with an empty input field (but an active checkbox) the field is re-filled with the default value (100 in our case).

Notes:

  • We default to limiting the queries so the checkbox is checked by default
  • We default to 100 results in the result set but people can change it as needed in the input field
  • Since the label of the number input is hidden, it should have an aria-label (copy: "Maximum number of results")

Needed components:

  • checkbox

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

We decided to not add validation for now, but rather wait until development work on the quantity component has started and we know which capabilities the Design System's NumberInput component is going to have.

as a reminder for verification - the top margin (the space between this component and the "add condition" button) is missing

\o/
This is good to close from my side. @Charlie_WMDE please close when it's fine from your side.

Charlie_WMDE claimed this task.

i guess we don't have a done column anymore so i will just resolve the ticket

Change 673549 had a related patch set uploaded (by Michael Große; owner: Michael Große):
[wikidata/query-builder@master] feat: add validation to Limit component

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

Change 673549 merged by jenkins-bot:
[wikidata/query-builder@master] feat: add validation to Limit component

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