On Mon, Nov 8, 2010 at 9:07 AM, Wichert Akkerman <wich...@wiggy.net> 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?
>
>  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.

Depending on what you're trying to do, though, a more satisfying algorithm
might be to use the document_map to find previously indexed objects and
reindex them.

Chris
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to