Skip to content

Commit

Permalink
fix: searching tag refinement was sometimes not working (#34935)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald authored Jun 7, 2024
1 parent 98689ab commit 009123a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion openedx/core/djangoapps/content/search/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,20 @@ def rebuild_index(status_cb: Callable[[str], None] | None = None) -> None:
])
# Mark which attributes are used for keyword search, in order of importance:
client.index(temp_index_name).update_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.tags,
# Keyword search does _not_ search the course name, course ID, breadcrumbs, block type, or other fields.
# 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,
])

############## Libraries ##############
Expand Down

0 comments on commit 009123a

Please sign in to comment.