Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace simple query string with custom query builder #3328

Open
sarayourfriend opened this issue Nov 8, 2023 · 0 comments
Open

Replace simple query string with custom query builder #3328

sarayourfriend opened this issue Nov 8, 2023 · 0 comments
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

Comments

@sarayourfriend
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant