[Zope3-Users] Looking for PathIndex

Gary Poster gary at zope.com
Wed Feb 1 07:53:51 EST 2006


On Feb 1, 2006, at 3:12 AM, Thierry FLORAC wrote:

>
>   Hi !
>
> I'm actually trying to create a Zope3 application, where I may be  
> able to make queries :
> - looking for content in the whole site
> - looking for content in a given "sub-site" or list of "sub-sites",  
> eventually including all it's "sub-folders".
>
> With Zope2, I was commonly using a PathIndex (mixed with other Text  
> of Field indexes), but I can't find any reference to this index  
> type in Zope3...
> Is it deprecated ?
> What is the best way to handle such queries with Zope3 ?
>
> Thanks for any help,
>
>   Thierry
>
>
> P.S.: are the DateIndex and DateRangeIndex also deprecated ? They  
> were very useful for me in Zope2...

For code similar in effect to the Zope 2 DateIndex and  
DateRangeIndex, look at

http://svn.zope.org/zc.catalog/trunk/src/zc/catalog/index.py?view=auto

The bottom of the file has a DateTimeValueIndex and a  
DateTimeSetIndex.  There's some discussion on what's going on here.   
The DateTimeValueIndex and DateTimeSetIndex are normalized versions  
of the value index and set index in the package.  The value index,  
set index, and normalizing features all have their own .txt document.

http://svn.zope.org/zc.catalog/trunk/src/zc/catalog/valueindex.txt? 
view=auto
http://svn.zope.org/zc.catalog/trunk/src/zc/catalog/setindex.txt? 
view=auto
http://svn.zope.org/zc.catalog/trunk/src/zc/catalog/ 
normalizedindex.txt?view=auto

For all of the indexes' features, it needs to be used in an extent  
catalog, also in the zc.catalog package.

For a path index, you could just have a set index (also in

http://svn.zope.org/zc.catalog/trunk/src/zc/catalog/index.py?view=auto

) that was configured via an adapter to index the containing paths of  
any given object.  For instance, if an object were at /foo/bar/baz/ 
bing, your adapter should return

['/foo', '/foo/bar', '/foo/bar/baz', and '/foo/bar/baz/bing']

Then searches for "Give me everything in '/foo/bar'" will return this  
object (as well as any others that are in the path).  This approach  
would probably also work with the keyword index in standard Zope, but  
I haven't looked at that in a while.

Gary


More information about the Zope3-users mailing list