def __flush_delete_event__(cls, target): from flaskshop.public.search import Item super().__flush_delete_event__(target) target.clear_mc(target) target.clear_category_cache(target) Item.delete(target)
def reindex(): """ clear elastic-search items. """ Item._index.delete(ignore=404) Item.init() products = Product.query.all() Item.bulk_update(products, op_type="create")
def __flush_insert_event__(cls, target): super().__flush_insert_event__(target) if current_app.config["USE_ES"]: from flaskshop.public.search import Item Item.add(target)
def __flush_after_update_event__(cls, target): super().__flush_after_update_event__(target) target.clear_mc(target) target.clear_category_cache(target) if current_app.config["USE_ES"]: from flaskshop.public.search import Item Item.update_item(target)
def __flush_insert_event__(cls, target): from flaskshop.public.search import Item super().__flush_insert_event__(target) Item.add(target)