fix: language facet feature flag and sort it alphabetically #82
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.
Context
The Algolia language indexing changes are working as expected, pulling the language name from the new course-discovery API response field
content_language_search_facet_name
.However, from a previous run of the Algolia re-indexing, we had indexed languages such as "American English" and "Mexican English" with the expectation that once we used this new approach described above, these would get overwritten to "English". While this worked for the majority of courses, it seems that if a course should no longer be indexed or part of the catalog (e.g., the course goes unpublished), we don't seem to be cleaning up the previously indexed records to remove the enterprise/catalog uuid <--> course mapping in Algolia.
This manifests in still seeing language options like "American English" or "Unknown language [es-bo]" in our Algolia index, when I would no longer expect to:
Related, clicking on the results from courses with these languages, you can see that the course is not part of the Enterprise Customer's catalog:
Due to this issue of not cleaning up the Algolia index when a course goes unpublished or is removed from an Enterprise Customer's catalog, I'm opting to put the Language facet behind a feature flag for now to prevent showing the incorrect language names / filtering for courses that can't be enrolled in.
Related PR for feature flag config setting: https://github.com/edx/edx-internal/pull/4786