Replace simple query string with custom query builder #3328
Labels
💻 aspect: code
Concerns the software code in the repository
🧰 goal: internal improvement
Improvement that benefits maintainers, not users
🟨 priority: medium
Not blocking but should be addressed soon
🧱 stack: api
Related to the Django API
Problem
We rely on simple query string to handle user inputs without complaining about bad or messy inputs and still returning sensible results. However, simple query string is relatively expensive. Jetpack, for example, uses its own query builder and parser classes to avoid simple query string.
https://github.com/Automattic/jetpack/blob/ee82adabbca4b04c0136a28b967a4dfcadb2f544/projects/packages/search/src/wpes/class-query-builder.php#L32
https://github.com/Automattic/jetpack/blob/ee82adabbca4b04c0136a28b967a4dfcadb2f544/projects/packages/search/src/wpes/class-query-parser.php#L41
Description
Openverse can implement the same approach.
Note: Jetpack code is licensed under GPLv2. As such, we must licence any Openverse derivative of these modules with a compatible licence (i.e., not MIT). Openverse intends to re-licence to GPL in the future anyway, to be in line with other WordPress Foundation projects, so this will not present issues down the line with licensing conflicts. For now, we can solve this issue by implementing the derived code in its own directory in the API package and adding a
LICENSE
file in that directory with a note at the top of any Python modules clarifying the relevant licence for that module.Additional context
This builds off of #3327 and should respect disabled features. In general, however, the user experience should remain unchanged.
The text was updated successfully, but these errors were encountered: