On Fri, Feb 25, 2011 at 3:41 PM, Danny Navarro <j...@dannynavarro.net> wrote:
> I also suspect that for folders with lots of items a list for order
> may not be the most efficient. What would be the persistent equivalent
> to an efficient list with ZODB? An IOBTree?
We use a IOBTree in plone.folder for storing the ordering. It maps
object position (0, 1, ...) to the id of the object.
Making it all insert/move/reordering operations efficient is a bit of
work. If you have a tree of 1000 items and move item 40 up 10
positions, you only want to change items 30 - 40 and not reorder the
entire tree. Maybe you don't have those kinds of use-cases at first.
In Plone we often have folders containing 10.000 or more items.
> I think I can to modify repoze.folder to support this behavior. Would
> a patch for repoze.folder be welcomed? I know for complex sortings it
> would be better to use repoze.catalog but I see it as the default
> order folder.
If you have one default ordering for a folder, it's actually better to
store it on the folder. Keeping it all local to the folder is less
overhead than doing a full-blown catalog search. If you want to sort
the folder items in different ways, then the catalog approach makes
more sense. In Plone we have fake index to sort by objection position,
which doesn't store extra data, but uses the ordering information of
each folder instead. That way you can still use the catalog, without
the extra data overhead.
Repoze-dev mailing list