[Zope3-Users] zc.catalog's FilterExtent (with hurry.query)

Jesper Petersen instantfoo at gmail.com
Sat Oct 27 09:40:17 EDT 2007


Hey!I'm trying to understand if my idea of how to use the FilterExtent in
zc.catalog (1.1.1) is
correct (and efficient). I'm also using hurry.query (0.9.3). My current
understanding of
extents is: they can be used to perform a search on a subset of a catalog.
For example,
"give me all objects where attr1 is 'foo' but only for intids 5,6,7 and 10"


Short version:
I have an extent of a large catalog. How do I make a search within this
extent?




Long version:
Basically, I have a few content components that can belong to several
"networks".


My idea is to have an extent in each network. Adding a component to several
networks is simply a matter of subscribing to an added event, looking at the
object's
"networks" attribute and add it to each of the specified networks via the
network's
extent.add method.


>>> list(BigCatalog.refs )
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
>>> list(network1.extent.set)
[1, 2, 5]
>>> list(network2.extent.set)
[2, 3, 5, 6, 11]


In turn, the members of my site can join these networks so I'd want an
extent on
each principal too. This is to allow a kind of "subscription" to his
networks. Also I'd want
some filter capabilities where the user can somehow change settings for the
filter
function, but I'll leave it for now..
Say, we have a member John, who's member of network1 & 2, his extent would
then
look like this (assuming he's not filtering anything from the networks):


>>> IUserExtent(john).extent.set
[1, 2, 3, 5, 6, 11]


SO, my main question now is, uhm, how do I actually make a search within a
network's
extent? I mean, I could do a search on the big catalog and then make a union
with the
network's extent:


>>> some_result & network1.extent
[1]


...But was it really meant to be used like this? I see you can set the
parent catalog on
the extent but I'm still not sure how to use it.


Regards
Jesper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20071027/4255cfee/attachment.htm


More information about the Zope3-users mailing list