add is_incomplete_or_stale to default sort #1641
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
closes https://github.com/mitodl/hq/issues/5658
Description (What does it do?)
#1627 added the is_incomplete_or_stale field to the search index
this pr updates the defualt search to use it
How can this be tested?
run ./manage.py recreate_index --all (if you have not since #1627 was merged)
comment out line 420 from learning_resource_search/constants.py to remove is_incomplete_or_stale from SOURCE_EXCLUDED_FIELDS
Go to http://api.open.odl.local:8063/api/v1/learning_resources_search/?topic=Biology
The first page should be all courses/programs with is_incomplete_or_stale=false. After a few pages you should see all courses/programs with is_incomplete_or_stale=true. For me that was the fourth page. The last few pages should be all learning materials (podcasts and videos)
If you manually created/updated a featured list associated with a channel and added a stale or incomplete learning resource to it you will still see an incomplete/stale resource at the start of the results since featured resources are shown first regardless of is_incomplete_or_stale state