Re: [Repoze-dev] repoze.catalog clear
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/08/2010 10:04 AM, Tres Seaver wrote: On 11/08/2010 09:07 AM, Wichert Akkerman wrote: I have some code (from Chris) which rebuilds a repoze.catalog instance. It uses a very simple algorithm: catalog.clear() for each obj in root: index object if object is folderish: process al its children unfortunately there is one problem with this code: any stale items in catalog.document_map are not cleared, so there is still cruft remaining after rebuilding the catalog. Can that be considered to be a bug? Seems like a bug to me. Hmm, OTOH: one might use the un-cleared document map to rebuild the catalog indexes / metadata internally (rather than crawling the content space tree). The Zope2 catalog's Advanced tab does the moral equivalent of this operation. Tres. - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software Excellence by Designhttp://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkzYEe4ACgkQ+gerLs4ltQ7XzQCgjlIxCEkif0pyUdQ5VhcOqjZb vZEAn1mQPXaaswMc/TyrEtw6EmZoqJUi =2t2a -END PGP SIGNATURE- ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] repoze.catalog clear
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/08/2010 10:10 AM, Wichert Akkerman wrote: On 11/8/10 16:09 , Chris Rossi wrote: The document_map, while sometimes stored on the catalog, is not known to the catalog. If you want to clear it, you need to do so explicitly. This is because r.catalog makes no assumptions about how you retrieve a document given a docid. The DocumentMap implementation is provided to fit a common case, but is still up to the app to manage. right. It would be nice if DocumentMap supported a clear() method though. The __init__ does what you want: def __init__(self): self.docid_to_address = IOBTree() self.address_to_docid = OIBTree() self.docid_to_metadata = IOBTree() Maybe you could just replace it? At any rate, I wouldn't object to renaming that method 'clear', and adding an '__init__' which called it. Tres. - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software Excellence by Designhttp://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkzYE/4ACgkQ+gerLs4ltQ65rwCdEgpNX0bDt7qm4WJPKzpCX41u rU0AniwOqy3eXKCrZQXXggKYoHT+Wc8u =HW9S -END PGP SIGNATURE- ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] repoze.catalog clear
On Mon, Nov 8, 2010 at 10:10 AM, Wichert Akkerman wich...@wiggy.net wrote: On 11/8/10 16:09 , Chris Rossi wrote: The document_map, while sometimes stored on the catalog, is not known to the catalog. If you want to clear it, you need to do so explicitly. This is because r.catalog makes no assumptions about how you retrieve a document given a docid. The DocumentMap implementation is provided to fit a common case, but is still up to the app to manage. right. It would be nice if DocumentMap supported a clear() method though. Hmm. Sure. I'll add that on trunk. Seems safe enough. In the meantime you could just create a new DocumentMap? Chris ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev