Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cms/djangoapps/contentstore/courseware_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,8 @@ class CourseAboutSearchIndexer(CoursewareSearchIndexer):
AboutInfo("org", AboutInfo.PROPERTY, AboutInfo.FROM_COURSE_PROPERTY),
AboutInfo("modes", AboutInfo.PROPERTY, AboutInfo.FROM_COURSE_MODE),
AboutInfo("language", AboutInfo.PROPERTY, AboutInfo.FROM_COURSE_PROPERTY),
AboutInfo("invitation_only", AboutInfo.PROPERTY, AboutInfo.FROM_COURSE_PROPERTY),
AboutInfo("catalog_visibility", AboutInfo.PROPERTY, AboutInfo.FROM_COURSE_PROPERTY),
]

@classmethod
Expand Down
17 changes: 16 additions & 1 deletion lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@
# .. toggle_tickets: https://openedx.atlassian.net/browse/OSPR-1880
'ENABLE_HTML_XBLOCK_STUDENT_VIEW_DATA': False,

# .. toggle_name: FEATURES['ENABLE_CHANGE_USER_PASSWORD_ADMIN']
# .. toggle_name: FEATURES['ENABLE_PASSWORD_RESET_FAILURE_EMAIL']
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: Whether to send an email for failed password reset attempts or not. This happens when a
Expand Down Expand Up @@ -3982,6 +3982,21 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring
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
# .. 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
# .. 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.
ACCOUNT_VISIBILITY_CONFIGURATION = {
Expand Down
9 changes: 9 additions & 0 deletions lms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,15 @@ def get_env_setting(setting):
SEARCH_ENGINE = "search.elastic.ElasticSearchEngine"
SEARCH_FILTER_GENERATOR = ENV_TOKENS.get('SEARCH_FILTER_GENERATOR', SEARCH_FILTER_GENERATOR)

SEARCH_SKIP_INVITATION_ONLY_FILTERING = ENV_TOKENS.get(
'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,
)

# TODO: Once we have successfully upgraded to ES7, switch this back to ELASTIC_SEARCH_CONFIG.
ELASTIC_SEARCH_CONFIG = ENV_TOKENS.get('ELASTIC_SEARCH_CONFIG_ES7', [{}])

Expand Down
6 changes: 6 additions & 0 deletions lms/lib/courseware_search/lms_filter_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This file contains implementation override of SearchFilterGenerator which will allow
* Filter by all courses in which the user is enrolled in
"""
from django.conf import settings
from search.filter_generator import SearchFilterGenerator

from openedx.core.djangoapps.course_groups.partition_scheme import CohortPartitionScheme
Expand Down Expand Up @@ -52,4 +53,9 @@ def exclude_dictionary(self, **kwargs):
if org_filter_out_set:
exclude_dictionary['org'] = list(org_filter_out_set)

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", True):
exclude_dictionary['catalog_visibility'] = 'none'

return exclude_dictionary