def remove_old_route_from_index(self): """Remove page from the website index if the route has changed.""" if self.allow_website_search_indexing() or frappe.flags.in_test: return old_doc = self.get_doc_before_save() # Check if the route is changed if old_doc and old_doc.route != self.route: # Remove the route from index if the route has changed remove_document_from_index(old_doc.route)
def update_website_search_index(self): """ Update the full test index executed on document change event. - remove document from index if document is unpublished - update index otherwise """ if not self.allow_website_search_indexing() or frappe.flags.in_test: return if self.is_website_published(): frappe.enqueue(update_index_for_path, path=self.route) elif self.route: # If the website is not published remove_document_from_index(self.route)
def on_trash(self): self.clear_cache() self.send_indexing_request("URL_DELETED") # On deleting the doc, remove the page from the web_routes index if self.allow_website_search_indexing(): remove_document_from_index(self.route)