[Zope-CMF] Optimizing catalog queries

Seb Bacon seb at jamkit.com
Mon Nov 10 06:54:41 EST 2003


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.

>>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.

In fact I've never used DateRangeIndexes like this so someone else may 
correct me, but this is my understanding.

Seb




More information about the Zope-CMF mailing list