"Júlio Dinis Silva" wrote:
Any hints? Best Regards, Julio Dinis Silva
From: "Júlio Dinis Silva" <juliodinis@hotmail.com> To: zope@zope.org Subject: [Zope] ZCatalog + Directory product question Date: Tue, 15 May 2001 18:29:37 +0100
Hi,
supose you have a product with two classes:
MyCategory | ---------- MyLink
Both classes are CatalogAware. The ideia of this classes is to implement a Directory like yahoo (think about the Yiahw product).
[snip]
Well the problem arises when you have 30 results in your search and all are Mylinks in a directory depth path of 10 category... The search becomes to heavy,i.e, scalability is compromised.
You should create an instance method (It will need to be a Python script, DTML methods cannot be indexed)to return the result of the value of active in the acquisition stack. Then index against this method. This puts the burden on updates, so whenever a MyCategory is changed from active to inactive, all child objects will need to be reindexed. This can be done by creating another Python script that gets called on updates to MyCategory objects. The indexed instance method could be something as simple as: return getattr(container, 'active', 0) Only set the active property on those objects that are actually active. Don't set the property at all on inactive objects. That way acquisition does the work instead of doing it manually (an probably much slower). To see if an object is active, just call the instance method.
I'm thinking I could use the zope security engine to do the active/deactive trick, i.e, when I deactivate one MyCategory I uncheck some security entry, then listing my directory I do a dtml-in with skip-unauthorized, and when I do a search I try to getObject MyLink's results as a anonymous role and then skip_unauthorized.
I think this skip_unauthorized could be the solution for this ZCatalog+Directory product scalability, because instead of running trough the PARENTS and check a property, I will be using zope's internal security mecanism.
That is a interesting idea, but I don't think it would really make it much faster. Although I could be wrong. Basically you would make it so that users performing the query didn't have view permissions on the inactive Categories. It would be more challenging to test as well. It would however make updates less intensive.
Any hints, Júlio Dinis Silva
hth, -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>