fixup! feat: options for excluding courses from search

This commit is contained in:
ha-D
2021-08-26 23:13:34 +00:00
committed by Braden MacDonald
parent a4b36346c9
commit 2d4c1ff25b
3 changed files with 17 additions and 6 deletions

View File

@@ -4009,9 +4009,20 @@ SEARCH_RESULT_PROCESSOR = "lms.lib.courseware_search.lms_result_processor.LmsSea
SEARCH_FILTER_GENERATOR = "lms.lib.courseware_search.lms_filter_generator.LmsSearchFilterGenerator"
# Override to skip enrollment start date filtering in course search
SEARCH_SKIP_ENROLLMENT_START_DATE_FILTERING = False
# Override to skip excluding invitation-only courses in course search
# .. toggle_name: SEARCH_SKIP_INVITATION_ONLY_FILTERING
# .. toggle_implementation: DjangoSetting
# .. toggle_default: True
# .. toggle_description: If enabled, invitation-only courses will appear in search results.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2021-08-27
SEARCH_SKIP_INVITATION_ONLY_FILTERING = True
# Override to skip excluding non-catalog courses in course search
# .. toggle_name: SEARCH_SKIP_SHOW_IN_CATALOG_FILTERING
# .. toggle_implementation: DjangoSetting
# .. toggle_default: True
# .. toggle_description: If enabled, courses with a catalog_visibility set to "none" will still
# appear in search results.
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2021-08-27
SEARCH_SKIP_SHOW_IN_CATALOG_FILTERING = True
# The configuration visibility of account fields.

View File

@@ -730,11 +730,11 @@ if FEATURES.get('ENABLE_COURSEWARE_SEARCH') or \
SEARCH_SKIP_INVITATION_ONLY_FILTERING = ENV_TOKENS.get(
'SEARCH_SKIP_INVITATION_ONLY_FILTERING',
SEARCH_SKIP_INVITATION_ONLY_FILTERING
SEARCH_SKIP_INVITATION_ONLY_FILTERING,
)
SEARCH_SKIP_SHOW_IN_CATALOG_FILTERING = ENV_TOKENS.get(
'SEARCH_SKIP_SHOW_IN_CATALOG_FILTERING',
SEARCH_SKIP_SHOW_IN_CATALOG_FILTERING
SEARCH_SKIP_SHOW_IN_CATALOG_FILTERING,
)
# TODO: Once we have successfully upgraded to ES7, switch this back to ELASTIC_SEARCH_CONFIG.

View File

@@ -53,9 +53,9 @@ class LmsSearchFilterGenerator(SearchFilterGenerator):
if org_filter_out_set:
exclude_dictionary['org'] = list(org_filter_out_set)
if not getattr(settings, "SEARCH_SKIP_INVITATION_ONLY_FILTERING", False):
if not getattr(settings, "SEARCH_SKIP_INVITATION_ONLY_FILTERING", True):
exclude_dictionary['invitation_only'] = True
if not getattr(settings, "SEARCH_SKIP_SHOW_IN_CATALOG_FILTERING", False):
if not getattr(settings, "SEARCH_SKIP_SHOW_IN_CATALOG_FILTERING", True):
exclude_dictionary['catalog_visibility'] = 'none'
return exclude_dictionary