Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Use terms instead of term #698

Closed
1 task
dhruvkb opened this issue May 15, 2022 · 2 comments
Closed
1 task

Use terms instead of term #698

dhruvkb opened this issue May 15, 2022 · 2 comments
Assignees
Labels
💻 aspect: code Concerns the software code in the repository ✨ goal: improvement Improvement to an existing user-facing feature good first issue New-contributor friendly help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed
Projects

Comments

@dhruvkb
Copy link
Member

dhruvkb commented May 15, 2022

Problem

In the search controller, when performing filtering for more than one value, we use an array of term queries instead of using terms.

filters = []
for arg in search_params.data[serializer_field].split(","):
_param = es_field or serializer_field
args = {"name_or_query": "term", _param: arg}
filters.append(Q(**args))
method = getattr(s, behaviour)

Description

Replace the array of term queries with a singular term query. According to the ES docs, the terms query is functionally identical to term.

Additional context

For an example, a terms query is used just a few lines below in the same file, inside the _exclude_filtered function.

s = s.exclude("terms", provider=to_exclude)

Implementation

  • 🙋 I would be interested in implementing this feature.
@dhruvkb dhruvkb added good first issue New-contributor friendly help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed ✨ goal: improvement Improvement to an existing user-facing feature 💻 aspect: code Concerns the software code in the repository labels May 15, 2022
@openverse-bot openverse-bot added this to Backlog in Openverse May 15, 2022
@openverse-bot openverse-bot moved this from Backlog to In progress in Openverse Jun 21, 2022
@ramadanomar
Copy link
Contributor

raising_hand I would be interested in implementing this feature.

@krysal
Copy link
Member

krysal commented Sep 20, 2022

Fixed in #902.

@krysal krysal closed this as completed Sep 20, 2022
Openverse automation moved this from In progress to Done! Sep 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository ✨ goal: improvement Improvement to an existing user-facing feature good first issue New-contributor friendly help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed
Projects
No open projects
Openverse
  
Done!
Development

Successfully merging a pull request may close this issue.

3 participants