def reindex_object(self, object): sm = getSiteManager() sm.notify(ObjectStartIndex(object)) uuid = object.uuid docid = self._document_map.docid_for_address(uuid) if not docid: self.index_object(object) docid = self._document_map.docid_for_address(uuid) # update the path of the object in the documentmap since the # object might have been renamed / moved path = object_to_path(object) self._document_map.add_metadata(docid, {'path': path}) try: self.catalog.reindex_doc(docid, object) self._p_changed = 1 self.catalog._p_changed = 1 self._document_map._p_changed = 1 self.__parent__._p_changed = 1 except: LOGGER.exception("Could not index object!")
def index_object(self, object): path = object_to_path(object) uuid = object.uuid docid = self._document_map.add(uuid) self._document_map.add_metadata(docid, {'path': path}) try: self.catalog.index_doc(docid, object) self._p_changed = 1 self.catalog._p_changed = 1 self._document_map._p_changed = 1 self.__parent__._p_changed = 1 except: LOGGER.exception("Could not index object!")
def test_object_to_path(self): assert ["f0", "x1"] == object_to_path(self.x1, as_list=True) assert "/f0/x1" == object_to_path(self.x1) assert ".f0.x1" == object_to_path(self.x1, path_sep=".")
def path(self): """ return the path of this resource """ return object_to_path(self)
def dottedpath(self): """ Return path as dot separated string """ return object_to_path(self, path_sep=".", as_list=False)
def path(self): """ Return path from root as list of id's""" return object_to_path(self, as_list=True)