-
Notifications
You must be signed in to change notification settings - Fork 211
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
Search controller uses should
for filtering instead of filter
#3243
Comments
@obulat @AetherUnbound Can I work on this? |
Yes, please! :) |
should
for filtering instead of must
should
for filtering instead of filter
@ngken0995, I updated the issue again, replacing |
@obulat I have add |
@ngken0995, you can use any browser to open this address: http://api.localhost:50280/v1/images/?license=by,by-sa. |
run |
@ngken0995 , could you run
|
@ngken0995, I know you've started working on this issue, but I think I've created a better and more comprehensive solution to the ES search query building. Would it be okay if I assigned this issue to myself? Sorry again for not telling this to you in advance. |
@obulat Go ahead on creating a PR. I was stuck on reproducing the error. I'm trying to understand the system design on openverse. First, I want to create a PR related to catalog to learn about DAGs, airflow, postgres and etc. Second, drive into ingestion server. Then I saw this issue which could help me understand ES. Could I reach out to you if I have any questions about catalog or ingestion server? |
Thank you, @ngken0995! |
Description
If you filter the search by
license
, the search controller creates the following query:There are two problems with it:
should
, which means that the results with other licenses can be returned (it's not a mandatory filter)boost
parameter which is unnecessary: instead of increasing the score of the item that has the required licenses, we should just filter out all of the items that don't have the required license.Solution
We should replace
should
withfilter
here:openverse/api/api/controllers/search_controller.py
Lines 260 to 270 in 0987949
should be:
This will use
elasticsearch_dsl
'sfilter
orexclude
methods to createfilter
ormust_not
clauses.Reproduction
The text was updated successfully, but these errors were encountered: