[Zope3-dev] Zope's PathIndex 'level' argument

sean.upton@uniontrib.com sean.upton@uniontrib.com
Mon, 25 Nov 2002 12:06:45 -0800


Sorry this doesn't directly answer your question, but I figured I would
share a thought on a major deficiency (IHMO) of specifying search
granularity in PathIndex queries.

I've never understood 'level'; I think it was designed to allow some sort of
relative path scheme in a query?  One thing that might be useful that
PathIndexes will not do right now (and something you might think level does
at initial glance, but doesn't) is allow you to specify how deep in a
hierarchy of folders something should be in your query.  Right now,
something is treated as a match in PathIndexes if even part of its path
(well, from left to right) matches the query.  This rules out using
PathIndexes for a query for items absolutely contained within a particular
container (which is a useful way to do both sorting and batching on an
objectmanager in Zope 2, with any decent performance, that is)... this, of
course, only makes sense for placeful content storage.  

In the Zope2 world, there are plenty of CMF skins that (I am thinking
specifically of Plone), that could ideally benefit in the UI scalability
department (1000s of content items in a folder) from using the catalog to
find items in a specific container, and still do batching and sorting.
BTreeFolder2 goes partway to solving this problem without the Catalog by
doing batching for storing large numbers of items in Zope2, but it doesn't
do sorting since its ids are stored in an already-sorted data structure when
you do batching with it.  Ideally, I think a PathIndex should allow you to
specify that an item must reside in a specific path, not just within that
path's hierarchy/subfolders; you cannot do this with a current PathIndex in
Zope2, and the improvisation to fix this is to create another index for the
path (as a string) as a fieldindex.

Of course, I have this interim fix, so perhaps I'm complaining about a
solved problem?

Sean

-----Original Message-----
From: Steve Alexander [mailto:steve@cat-box.net]
Sent: Monday, November 25, 2002 11:27 AM
To: zope3-dev@zope.org
Subject: [Zope3-dev] Zope's PathIndex 'level' argument


I'm implementing the functionality of a PathIndex for Zope 3.

In Zope 2, when querying a PathIndex, you can give it an optional 
'level' argument in addition to the base-path that you're interested in.

Does anyone use this 'level' argument? What are its use-cases?

The level is 0 by default. There's a comment in the code saying that a 
negative level doesn't work yet, but there appears to be code that 
implements that case.

If anyone does have a use for the 'level' argument, is there a use-case 
for supporting negative levels.

(I'm deliberately not describing what 'level' does here.)

--
Steve Alexander


_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
http://lists.zope.org/mailman/listinfo/zope3-dev