-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: incremental reindex_studio management command (#35864)
This allows large instances to run an (interruptable, resumable) reindex task that can cover thousands of courses.
- Loading branch information
1 parent
3196ceb
commit b07464b
Showing
6 changed files
with
342 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
"""Configuration for the search index.""" | ||
from .documents import Fields | ||
|
||
|
||
INDEX_DISTINCT_ATTRIBUTE = "usage_key" | ||
|
||
# Mark which attributes can be used for filtering/faceted search: | ||
INDEX_FILTERABLE_ATTRIBUTES = [ | ||
# Get specific block/collection using combination of block_id and context_key | ||
Fields.block_id, | ||
Fields.block_type, | ||
Fields.context_key, | ||
Fields.usage_key, | ||
Fields.org, | ||
Fields.tags, | ||
Fields.tags + "." + Fields.tags_taxonomy, | ||
Fields.tags + "." + Fields.tags_level0, | ||
Fields.tags + "." + Fields.tags_level1, | ||
Fields.tags + "." + Fields.tags_level2, | ||
Fields.tags + "." + Fields.tags_level3, | ||
Fields.collections, | ||
Fields.collections + "." + Fields.collections_display_name, | ||
Fields.collections + "." + Fields.collections_key, | ||
Fields.type, | ||
Fields.access_id, | ||
Fields.last_published, | ||
Fields.content + "." + Fields.problem_types, | ||
] | ||
|
||
# Mark which attributes are used for keyword search, in order of importance: | ||
INDEX_SEARCHABLE_ATTRIBUTES = [ | ||
# Keyword search does _not_ search the course name, course ID, breadcrumbs, block type, or other fields. | ||
Fields.display_name, | ||
Fields.block_id, | ||
Fields.content, | ||
Fields.description, | ||
Fields.tags, | ||
Fields.collections, | ||
# If we don't list the following sub-fields _explicitly_, they're only sometimes searchable - that is, they | ||
# are searchable only if at least one document in the index has a value. If we didn't list them here and, | ||
# say, there were no tags.level3 tags in the index, the client would get an error if trying to search for | ||
# these sub-fields: "Attribute `tags.level3` is not searchable." | ||
Fields.tags + "." + Fields.tags_taxonomy, | ||
Fields.tags + "." + Fields.tags_level0, | ||
Fields.tags + "." + Fields.tags_level1, | ||
Fields.tags + "." + Fields.tags_level2, | ||
Fields.tags + "." + Fields.tags_level3, | ||
Fields.collections + "." + Fields.collections_display_name, | ||
Fields.collections + "." + Fields.collections_key, | ||
Fields.published + "." + Fields.display_name, | ||
Fields.published + "." + Fields.published_description, | ||
] | ||
|
||
# Mark which attributes can be used for sorting search results: | ||
INDEX_SORTABLE_ATTRIBUTES = [ | ||
Fields.display_name, | ||
Fields.created, | ||
Fields.modified, | ||
Fields.last_published, | ||
] | ||
|
||
# Update the search ranking rules to let the (optional) "sort" parameter take precedence over keyword relevance. | ||
INDEX_RANKING_RULES = [ | ||
"sort", | ||
"words", | ||
"typo", | ||
"proximity", | ||
"attribute", | ||
"exactness", | ||
] |
Oops, something went wrong.