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
41 changes: 0 additions & 41 deletions cms/djangoapps/contentstore/courseware_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from common.djangoapps.course_modes.models import CourseMode
from openedx.core.lib.courses import course_image_url, course_organization_image_url
from xmodule.annotator_mixin import html_to_text # pylint: disable=wrong-import-order
from xmodule.library_tools import normalize_key_for_search # pylint: disable=wrong-import-order
from xmodule.modulestore import ModuleStoreEnum # pylint: disable=wrong-import-order

# REINDEX_AGE is the default amount of time that we look back for changes
Expand Down Expand Up @@ -443,46 +442,6 @@ def supplemental_fields(cls, item):
}


class LibrarySearchIndexer(SearchIndexerBase):
"""
Base class to perform indexing for library search from different modulestores
"""
INDEX_NAME = "library_index"
ENABLE_INDEXING_KEY = 'ENABLE_LIBRARY_INDEX'

INDEX_EVENT = {
'name': 'edx.library.index.reindexed',
'category': 'library_index'
}

@classmethod
def normalize_structure_key(cls, structure_key):
""" Normalizes structure key for use in indexing """
return normalize_key_for_search(structure_key)

@classmethod
def _fetch_top_level(cls, modulestore, structure_key):
""" Fetch the item from the modulestore location """
return modulestore.get_library(structure_key, depth=None)

@classmethod
def _get_location_info(cls, normalized_structure_key):
""" Builds location info dictionary """
return {"library": str(normalized_structure_key)}

@classmethod
def _id_modifier(cls, usage_id):
""" Modifies usage_id to submit to index """
return usage_id.replace(library_key=(usage_id.library_key.replace(version_guid=None, branch=None)))

@classmethod
def do_library_reindex(cls, modulestore, library_key):
"""
(Re)index all content within the given library, tracking the fact that a full reindex has taken place
"""
return cls._do_reindex(modulestore, library_key)


class AboutInfo:
""" About info structure to contain
1) Property name to use
Expand Down
66 changes: 0 additions & 66 deletions cms/djangoapps/contentstore/management/commands/reindex_library.py

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions cms/djangoapps/contentstore/signals/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from cms.djangoapps.contentstore.courseware_index import (
CourseAboutSearchIndexer,
CoursewareSearchIndexer,
LibrarySearchIndexer,
)
from common.djangoapps.track.event_transaction_utils import get_event_transaction_id, get_event_transaction_type
from common.djangoapps.util.block_utils import yield_dynamic_block_descendants
Expand Down Expand Up @@ -176,19 +175,6 @@ def listen_for_course_delete(sender, course_key, **kwargs): # pylint: disable=u
CourseAboutSearchIndexer.remove_deleted_items(course_key)


@receiver(SignalHandler.library_updated)
def listen_for_library_update(sender, library_key, **kwargs): # pylint: disable=unused-argument
"""
Receives signal and kicks off celery task to update search index
"""

if LibrarySearchIndexer.indexing_is_enabled():
# import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
from cms.djangoapps.contentstore.tasks import update_library_index

update_library_index.delay(str(library_key), datetime.now(UTC).isoformat())


@receiver(SignalHandler.pre_item_delete)
def handle_item_deleted(**kwargs) -> None:
"""
Expand Down
15 changes: 0 additions & 15 deletions cms/djangoapps/contentstore/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import cms.djangoapps.contentstore.errors as UserErrors
from cms.djangoapps.contentstore.courseware_index import (
CoursewareSearchIndexer,
LibrarySearchIndexer,
SearchIndexingError,
)
from cms.djangoapps.contentstore.storage import course_import_export_storage
Expand Down Expand Up @@ -292,20 +291,6 @@ def update_search_index(course_id, triggered_time_isoformat):
LOGGER.debug('Search indexing successful for complete course %s', course_id)


@shared_task
@set_code_owner_attribute
def update_library_index(library_id, triggered_time_isoformat):
""" Updates course search index. """
try:
library_key = CourseKey.from_string(library_id)
LibrarySearchIndexer.index(modulestore(), library_key, triggered_at=(_parse_time(triggered_time_isoformat)))

except SearchIndexingError as exc:
LOGGER.error('Search indexing error for library %s - %s', library_id, str(exc))
else:
LOGGER.debug('Search indexing successful for library %s', library_id)


@shared_task
@set_code_owner_attribute
def update_special_exams_and_publish(course_key_str):
Expand Down
Loading
Loading