[Erp5-dev] error on wiki page, pls check

Yoshinori Okuji yo at nexedi.com
Wed Mar 29 03:37:17 CEST 2006


On Tuesday 28 March 2006 18:44, Jérôme Perrin wrote:
> > Can somebody please check the wiki page that I wrote two days ago, on
> > HowToAddTableToCatalog? I figured out that what I wrote there is
> > wrong, because the z_catalog_email_list is called every time I reindex
> > any object, which throws an exception if it the object is not an email
> > address. So I guess there must be a way to specify which catalog
> > methods are called when reindexing certain portal_types, or something
> > like that, but I don't know how.
>
> Hi bartek
>
> Currently, in various catalog method (stock, movement, item ...) we check
> wether we should index the object in the method.
> For exemple, z_catalog_movement_list first check the list of objects that
> are actually movement (using isMovement attribute) and only catalog them if
> the attribute is true.
> So in your case, you can just filter the list of objects, using for example
> getPortalType.

Not completely true. The filtering in each catalog method is mostly for 
"safety guard" against wrong settings. The right way to filter objects is to 
use the filtering feature in SQLCatalog itself. Just go to the tab Filter, 
and set whatever you need. You can filter objects based on portal types 
and/or TALES expressions.

The reason why this is better is the performance: if you filter objects in 
methods, the arguments are always parsed for all objects, even when they are 
filtered out. If you filter objects in the filtering feature, the arguments 
are not parsed for objects not being catalogged. This performance penalty 
might be negligible in the case of email, because the data is simple, but it 
is still a good idea to avoid such an unneeded overhead.

YO
-- 
Yoshinori Okuji, Nexedi CTO
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Full Featured High End Open Source ERP
http://www.erp5.com
ERP5 Wiki: Developer Zone for ERP5 Community
http://wiki.erp5.org



More information about the Erp5-dev mailing list