Description
openedon Oct 27, 2023
Problem
The license
filter parameter accepts a comma-separated list of licenses.
The license_type
filter parameter accepts comma-separated list of items like all
, all-cc
, commercial
, and modification
. These values are then converted into a list of the licenses that correspond to this category. For instance, license_type=commercial,modification
URL search filter will be converted to ['by', 'sampling+', 'by-sa', 'cc0', 'pdm']
(excluding all of the ND
and NC
licenses).
Both of these filters are then converted to 2 separate ES terms queries: one with the list from license
parameter, and another with the list of license_type
values.
What should happen in an edge case when the user specifies a license that is outside of the specified license type? For instance, license=by-nd&license_type=commercial,modification
that will create the following query:
"filter": [
{
"terms": {
"license": ["by-nd"]
}
},
{
"terms": {
"license": ["by", "sampling+", "by-sa", "cc0", "pdm"]
}
}
]
This query (https://api.openverse.engineering/v1/images/?format=json&license=by-nd&license_type=commercial,modification&page_size=1) will not return any results because the license queries are mutually exclusive.
@WordPress/openverse-maintainers, should we return an error response with a message that the license
and license_type
parameters are incompatible? Or should we just add a note to the API documentation, and keep returning an empty result as we do now?
Metadata
Assignees
Labels
Type
Projects
Status
📋 Backlog