This functionality will allow for a user to find a particular set of QIDs that match a criteria. For example, looking for all items that have occupation = actor
searchItems(query: Filter!): [ItemSearchResult]!
type ItemSearchResult {
id: ItemId!
label(languageCode: String!): String
description(languageCode: String!): String
}
input Filter {
and: [Filter!]
property: PropertyId
value: String
}Note that the value could be omitted to indicate that the query criteria means "any statement with predicate property", i.e. not including any specific value.
In the first increment only properties with "data value type" string or wikibase-entityid are allowed to be used in filters.
If a property of a different data value type is used in any filter, the API should reject the query and return an error to the client.
Pagination is not considered in this iteration of the functionality. The API should return a list of up to 50 results.
Example
searchItems(query: {
and: [
{ property: “P106”, value: “Q33999” }, # occupation=actor
{ property: “P21”, value: “Q6581072” } # sex or gender=female
]
}) {
label(languageCode: “en”)
}Acceptance criteria:
- Be able to look up items by their statement properties and values
- The return type is a list (even if only one element is returned, it will be a list of length 1)
- User can query by multiple statement properties and values
Task breakdown:
- create a very simple happy path implementation that only returns a list of Item IDs
- create a haswbstatement keyword search and call CirrusSearch service
- include a hard limit of 50 results
- include the Item namespace to search in
- create a SearchItems use case with the query as request
- for testing, a simple InMemory search by statement property is needed
- create a haswbstatement keyword search and call CirrusSearch service
- fetch labels
- use the existing use case
- fetch description
- create a new BatchGetItemDescriptions use case
- validation:
- filter (no fields, all fields, illegal query, unsupported property data types)
- include a limit on the number of searches allowed in one request (maybe 1 for now?)
- fail gracefully when WikibaseCirrusSearch is not enabled