Exemple #1
0
subscribe(text.process_index_title_change_in_dependant_records,         text.Index, "attributeChange", "title")
subscribe(version_state.process_index_title_change_in_version_state,    text.Index, "attributeChange", "title")
subscribe(cascade(notification.GlobalNotificationSet, "content.index"), text.Index, "attributeChange", "title")
# Taken care of on save
# subscribe(text.process_index_change_in_toc,                             text.Index, "attributeChange", "title")


# Index Delete (start with cache clearing)
subscribe(text.process_index_delete_in_core_cache,                      text.Index, "delete")
subscribe(version_state.process_index_delete_in_version_state,          text.Index, "delete")
subscribe(link.process_index_delete_in_links,                           text.Index, "delete")
subscribe(note.process_index_delete_in_notes,                           text.Index, "delete")
subscribe(text.process_index_delete_in_versions,                        text.Index, "delete")
subscribe(translation_request.process_index_delete_in_translation_requests, text.Index, "delete")
subscribe(text.process_index_delete_in_toc,                             text.Index, "delete")
subscribe(cascade_delete(notification.GlobalNotificationSet, "content.index", "title"),   text.Index, "delete")


# Process in ES
# todo: handle index name change in ES
def process_version_title_change_in_search(ver, **kwargs):
    from sefaria.local_settings import SEARCH_INDEX_ON_SAVE
    if SEARCH_INDEX_ON_SAVE:
        from sefaria.search import delete_version, TextIndexer, get_new_and_current_index_names
        search_index_name = get_new_and_current_index_names("text")['current']
        # no reason to deal with merged index since versions don't exist. still leaving this here in case it is necessary
        # search_index_name_merged = get_new_and_current_index_names("merged")['current']
        text_index = library.get_index(ver.title)
        delete_version(text_index, kwargs.get("old"), ver.language)
        for ref in text_index.all_segment_refs():
            TextIndexer.index_ref(search_index_name, ref, kwargs.get("new"), ver.language, False)
Exemple #2
0
subscribe(cascade(person.PersonSet, "generation"), time.TimePeriod,
          "attributeChange", "symbol")

# Person key change
subscribe(cascade(person.PersonRelationshipSet, "to_key"), person.Person,
          "attributeChange", "key")
subscribe(cascade(person.PersonRelationshipSet, "from_key"), person.Person,
          "attributeChange", "key")
subscribe(cascade_to_list(text.IndexSet, "authors"), person.Person,
          "attributeChange", "key")

subscribe(cascade(person.PersonRelationshipSet, "type"),
          person.PersonRelationshipType, "attributeChange", "key")

# Person delete
subscribe(cascade_delete(person.PersonRelationshipSet, "to_key", "key"),
          person.Person, "delete")
subscribe(cascade_delete(person.PersonRelationshipSet, "from_key", "key"),
          person.Person, "delete")
subscribe(cascade_delete_to_list(text.IndexSet, "authors", "key"),
          person.Person, "delete")

# Gardens
subscribe(cascade(garden.GardenStopSet, "garden"), garden.Garden,
          "attributeChange", "key")
subscribe(cascade_delete(garden.GardenStopSet, "garden", "key"), garden.Garden,
          "delete")
subscribe(cascade(garden.GardenStopRelationSet, "garden"), garden.Garden,
          "attributeChange", "key")
subscribe(cascade_delete(garden.GardenStopRelationSet, "garden", "key"),
          garden.Garden, "delete")
# Version State Save
subscribe(translation_request.process_version_state_change_in_translation_requests, version_state.VersionState, "save")

# Time
subscribe(cascade(person.PersonSet, "era"),                              time.TimePeriod, "attributeChange", "symbol")
subscribe(cascade(person.PersonSet, "generation"),                       time.TimePeriod, "attributeChange", "symbol")

# Person key change
subscribe(cascade(person.PersonRelationshipSet, "to_key"),               person.Person, "attributeChange", "key")
subscribe(cascade(person.PersonRelationshipSet, "from_key"),             person.Person, "attributeChange", "key")
subscribe(cascade_to_list(text.IndexSet, "authors"),                     person.Person, "attributeChange", "key")

subscribe(cascade(person.PersonRelationshipSet, "type"),                 person.PersonRelationshipType, "attributeChange", "key")

# Person delete
subscribe(cascade_delete(person.PersonRelationshipSet, "to_key", "key"), person.Person, "delete")
subscribe(cascade_delete(person.PersonRelationshipSet, "from_key", "key"), person.Person, "delete")
subscribe(cascade_delete_to_list(text.IndexSet, "authors", "key"),       person.Person, "delete")

# Gardens
subscribe(cascade(garden.GardenStopSet, "garden"),                              garden.Garden, "attributeChange", "key")
subscribe(cascade_delete(garden.GardenStopSet, "garden", "key"),                garden.Garden, "delete")
subscribe(cascade(garden.GardenStopRelationSet, "garden"),                  garden.Garden, "attributeChange", "key")
subscribe(cascade_delete(garden.GardenStopRelationSet, "garden", "key"),    garden.Garden, "delete")
# from stop to stop rel


# todo: notes? reviews?
# todo: Scheme name change in Index
# todo: term change in nodes
Exemple #4
0
# Version State Save
subscribe(translation_request.process_version_state_change_in_translation_requests, version_state.VersionState, "save")

# Time
subscribe(cascade(person.PersonSet, "era"),                                time.TimePeriod, "attributeChange", "symbol")
subscribe(cascade(person.PersonSet, "generation"),                         time.TimePeriod, "attributeChange", "symbol")

# Person key change
subscribe(cascade(person.PersonRelationshipSet, "to_key"),                 person.Person, "attributeChange", "key")
subscribe(cascade(person.PersonRelationshipSet, "from_key"),               person.Person, "attributeChange", "key")
subscribe(cascade_to_list(text.IndexSet, "authors"),                       person.Person, "attributeChange", "key")

subscribe(cascade(person.PersonRelationshipSet, "type"),                   person.PersonRelationshipType, "attributeChange", "key")

# Person delete
subscribe(cascade_delete(person.PersonRelationshipSet, "to_key", "key"),   person.Person, "delete")
subscribe(cascade_delete(person.PersonRelationshipSet, "from_key", "key"), person.Person, "delete")
subscribe(cascade_delete_to_list(text.IndexSet, "authors", "key"),         person.Person, "delete")

# Gardens
subscribe(cascade(garden.GardenStopSet, "garden"),                         garden.Garden, "attributeChange", "key")
subscribe(cascade_delete(garden.GardenStopSet, "garden", "key"),           garden.Garden, "delete")
subscribe(cascade(garden.GardenStopRelationSet, "garden"),                 garden.Garden, "attributeChange", "key")
subscribe(cascade_delete(garden.GardenStopRelationSet, "garden", "key"),   garden.Garden, "delete")
# from stop to stop rel

subscribe(cascade_delete(notification.NotificationSet, "global_id", "_id"),notification.GlobalNotification, "delete")

# todo: notes? reviews?
# todo: Scheme name change in Index
# todo: term change in nodes