[Zope-CMF] Optimizing catalog queries

Gitte Wange gitte at mmmanager.org
Mon Nov 10 07:08:25 EST 2003


Mandag 10 november 2003 12:54   skrev Seb Bacon:
> Gitte Wange wrote:
> >>You should always see an improvement using DateIndexes or
> >>DateRangeIndexes over FieldIndexes.  Don't forget to change effective,
> >>expires, modified etc into DateRangeIndexes too.
> >
> > They should be DateRangeIndexes ?
>
> Sorry, DateIndexes.

Okay :-)
I have changed the indexes now but couldn't change the index for 'expires'. I 
simply got an Overflow Error, because the date it tried to index is 
9998/12/31 and the _convert method raised an overflow error. I can see that 
there is a long time untill year 9998 but shouldn't it be able to handle such 
a date ?
Will try an Google for answers.

> >>DateRangeIndex is for things which should be between two dates, e.g.
> >>time 'A' where 'effective' < 'A' < 'expires'; google for examples.
> >
> > I have googled and found a lot of hits but nothing that really explained
> > it - will try again.
>
> for an index 'isEffective' you might put a 'start' field of 'effective'
> and an 'end' field of 'expires'.  You then don't need to do the 'range'
> stuff in your isEffective=DateTime() query.  However, in your case you
> probably want to keep individual 'effective' and 'expires' indexes for
> backwards compatibility or other application-specific reasons.  These
> should be DateIndexes.

Arh - that enlightend me a lot! Nice - can see some scenarios where that may 
be handy to use. Thanks Seb !

-- 
Gitte Wange
Technical Manager

Email: gitte at mmmanager.org
Web: http://www.mmmanager.org
Tlf: +45 36 46 20 02

This breaks the cron job that calls self.Zoo.Diet.LargeAnimals.hippo.feed(),
and all the hippos starve. Someone uses
self.Zoo.Diet.buildings.visitor_reception.feed(),
and ends up filling the reception with hippo food.

    -- Toby Dickenson, 20 Oct 2000 (Talking about URL Traversal), 




More information about the Zope-CMF mailing list