The **quantity** property, when used as a qualifier for 'depicts', indicates the quantity of the thing-that-is-depicted
Example from wikidata https://www.wikidata.org/wiki/Q1195035 (see depicts > human > quantity, etc)
We want users to be able to include quantities in their searches - for example to find images depicting >10 people (probably with a search term like `haswbstatement:P180=Q5[P1114>10]`), or exactly one cat (`haswbstatement:P180=Q146[P1114=1]`).
I can think of 3 different options for implementing searching on quantity
Option 1
We can store the qualifier in the normal way like this `P180=Q5[P1114=2]` (see T193407), in which case we would only be able to find exact matches. For example a user could search for images depicting exactly 1 cat, but could not search for images with >1 cats
Option 2
Store the data in an individual numeric field in elasticsearch, and come up with some kind of hack to relate the numeric quantity to a specific 'depicts' statement. Tricky, and not even sure it's possible
Option 3
Use the Wikidata Query Service (WDQS) to run a SPARQL query (which allows operators like `>` and `<`), and then use the ids as a filter for an elasticsearch query - basically we'd ask WDQS for all pictures depicting 'cat' with quantity qualifier >1, then search elasticsearch for anything else we wanted to search for but only among the (max 1000) IDs we got from WDQS. Note that because of limitations passing data between WDQS and elasticsearch there will be edge cases where no results will be returned even if appropriate results exist.
The deepcat feature uses WDQS with elasticsearch, so we could base our approach on the deepcat code (see https://gerrit.wikimedia.org/r/#/c/405059/)
This option depends on T194401
-----
Note that there are currently **1025** items in wikidata that have a 'depicts' statement with a 'quantity' qualifier out of a total of ~70k items with depicts statements (~1.5%)