range:min bug in ZCatalogs fo Zope 2.3.2
Hi, I have encountered a strange problem with ZCatalogs in Zope 2.3.2. We have objects having DateTime arguments effective_date and expiration_date that gets indexed in different ZCatalogs. (The index is a field index). We then tries to get all published objects that have not yet been archived: now=_.DateTime() Service.searchResults( effective_date =now, effective_date_usage='range:max' , expiration_date =now, expiration_date_usage='range:min' ) Now this works fine, until one day when result searchResults returns an empty result list which is not expected. It seems to be that some days the range:min statement doesn't work correctly. (I tried with different range:* combinations and the only thing I found not working is the range:min statement (some days). If I instead use a different value for now: now2 = _.DateTime(now.Date()) # now.Date() returns somethong like "2002/03/21" which in turn makes the now2 equal to the DateTime value "2002/03/21 00:00:000 GMT+1" (GMT+1 is my local TimeZone) Now using now2 in: Service.searchResults( effective_date =now, effective_date_usage='range:max' , expiration_date =now2, expiration_date_usage='range:min' ) will always result in a list (all though it gets quantized to midnight the resulting list will be somewhat biased). What I don't seem to understand is that DateTime() and DateTime(DateTime().Date) gets so different results. Have anyone seen something like this before? Best Regards, Johan Carlsson -- Johan Carlsson, Torped AB http://www.torped.se -- http://easypublisher.torped.se
Try to reproduce the same problem under 2.5.X. Or upgrade to 2.5.X. Andreas ----- Original Message ----- From: "Johan Carlsson [Torped]" <johanc@torped.se> To: <zope@zope.org>; <zope-dev@zope.org> Sent: Thursday, March 21, 2002 05:51 Subject: [Zope] range:min bug in ZCatalogs fo Zope 2.3.2
Hi, I have encountered a strange problem with ZCatalogs in Zope 2.3.2.
We have objects having DateTime arguments effective_date and expiration_date that gets indexed in different ZCatalogs. (The index is a field index).
We then tries to get all published objects that have not yet been archived:
now=_.DateTime() Service.searchResults( effective_date =now, effective_date_usage='range:max' , expiration_date =now, expiration_date_usage='range:min' )
Now this works fine, until one day when result searchResults returns an empty result list which is not expected. It seems to be that some days the range:min statement doesn't work correctly. (I tried with different range:* combinations and the only thing I found not working is the range:min statement (some days).
If I instead use a different value for now:
now2 = _.DateTime(now.Date()) # now.Date() returns somethong like "2002/03/21" which in turn makes the now2 equal to the DateTime value "2002/03/21 00:00:000 GMT+1" (GMT+1 is my local TimeZone)
Now using now2 in:
Service.searchResults( effective_date =now, effective_date_usage='range:max' , expiration_date =now2, expiration_date_usage='range:min' )
will always result in a list (all though it gets quantized to midnight the resulting list will be somewhat biased).
What I don't seem to understand is that DateTime() and DateTime(DateTime().Date) gets so different results.
Have anyone seen something like this before?
Best Regards, Johan Carlsson
-- Johan Carlsson, Torped AB
http://www.torped.se -- http://easypublisher.torped.se
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
At 06:08 2002-03-21 -0500, you wrote:
Try to reproduce the same problem under 2.5.X. Or upgrade to 2.5.X. Andreas
The problem is reproducible in Zope 2.3.2 but doesn't appear in Zope 2.5.0. What I have tested is a OOBTree with DateTime values (or None) as keys and IITreeSet or integers as values (as in the case with FieldIndexes). The OOBTrees items method gets called with one argument (a DateTime) resulting in a list of sets containing items with keys larger than the passed DateTime value. When tested on Zope 2.3.2 some dates result in a empty list. So, upgrading our software to 2.5.0 would take some time and I need a quick fix. Would it be possible to run the BTree code from Zope 2.5.0 in Zope 2.3.2? Best Regards, Johan Carlsson
Hi, I have encountered a strange problem with ZCatalogs in Zope 2.3.2.
We have objects having DateTime arguments effective_date and expiration_date that gets indexed in different ZCatalogs. (The index is a field index).
We then tries to get all published objects that have not yet been archived:
now=_.DateTime() Service.searchResults( effective_date =now, effective_date_usage='range:max' , expiration_date =now, expiration_date_usage='range:min' )
Now this works fine, until one day when result searchResults returns an empty result list which is not expected. It seems to be that some days the range:min statement doesn't work correctly. (I tried with different range:* combinations and the only thing I found not working is the range:min statement (some days).
If I instead use a different value for now:
now2 = _.DateTime(now.Date()) # now.Date() returns somethong like "2002/03/21" which in turn makes the now2 equal to the DateTime value "2002/03/21 00:00:000 GMT+1" (GMT+1 is my local TimeZone)
Now using now2 in:
Service.searchResults( effective_date =now, effective_date_usage='range:max' , expiration_date =now2, expiration_date_usage='range:min' )
will always result in a list (all though it gets quantized to midnight the resulting list will be somewhat biased).
What I don't seem to understand is that DateTime() and DateTime(DateTime().Date) gets so different results.
Have anyone seen something like this before?
Best Regards, Johan Carlsson
-- Johan Carlsson, Torped AB
http://www.torped.se -- http://easypublisher.torped.se
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
BTrees were rewritten in 2.4.0 so I assume you will run into problems. Please check the release notes for the latest 2.3.X version if there were some fixes for your problem since 2.3.2. -aj ----- Original Message ----- From: "Johan Carlsson [Torped]" <johanc@torped.se> To: "Andreas Jung" <andreas@andreas-jung.com>; <zope-dev@zope.org> Sent: Friday, March 22, 2002 04:01 Subject: Re: [Zope] range:min bug in ZCatalogs fo Zope 2.3.2
At 06:08 2002-03-21 -0500, you wrote:
Try to reproduce the same problem under 2.5.X. Or upgrade to 2.5.X. Andreas
The problem is reproducible in Zope 2.3.2 but doesn't appear in Zope 2.5.0.
What I have tested is a OOBTree with DateTime values (or None) as keys and IITreeSet or integers as values (as in the case with FieldIndexes). The OOBTrees items method gets called with one argument (a DateTime) resulting in a list of sets containing items with keys larger than the passed DateTime value. When tested on Zope 2.3.2 some dates result in a empty list.
So, upgrading our software to 2.5.0 would take some time and I need a quick fix. Would it be possible to run the BTree code from Zope 2.5.0 in Zope 2.3.2?
Best Regards, Johan Carlsson
Hi, I have encountered a strange problem with ZCatalogs in Zope 2.3.2.
We have objects having DateTime arguments effective_date and expiration_date that gets indexed in different ZCatalogs. (The index is a field index).
We then tries to get all published objects that have not yet been archived:
now=_.DateTime() Service.searchResults( effective_date =now, effective_date_usage='range:max' , expiration_date =now, expiration_date_usage='range:min' )
Now this works fine, until one day when result searchResults returns an empty result list which is not expected. It seems to be that some days the range:min statement doesn't work correctly. (I tried with different range:* combinations and the only thing I found not working is the range:min statement (some days).
If I instead use a different value for now:
now2 = _.DateTime(now.Date()) # now.Date() returns somethong like "2002/03/21" which in turn makes the now2 equal to the DateTime value "2002/03/21 00:00:000 GMT+1" (GMT+1 is my local TimeZone)
Now using now2 in:
Service.searchResults( effective_date =now, effective_date_usage='range:max' , expiration_date =now2, expiration_date_usage='range:min' )
will always result in a list (all though it gets quantized to midnight the resulting list will be somewhat biased).
What I don't seem to understand is that DateTime() and DateTime(DateTime().Date) gets so different results.
Have anyone seen something like this before?
Best Regards, Johan Carlsson
-- Johan Carlsson, Torped AB
http://www.torped.se -- http://easypublisher.torped.se
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
At 05:45 2002-03-22 -0500, you wrote:
BTrees were rewritten in 2.4.0 so I assume you will run into problems. Please check the release notes for the latest 2.3.X version if there were some fixes for your problem since 2.3.2.
-aj
The interface seems to be equal with the old one? Comparing the Components/BTree folder there doesn't seem to be an enormous amount of changes. Has it been rewritten or has it only been fixed? Reading the Change files from 2.4.0 and forth indicates 3 bug fixes related to BTree? It seems to be possible to compile the BTree extention module and just replace that. Are there any "don't thats" I should be where of? Like changes in python extensions between Python 1.5.2 and Python 2.1.2? Regards, Johan Carlsson
At 05:45 2002-03-22 -0500, Andreas Jung wrote:
BTrees were rewritten in 2.4.0 so I assume you will run into problems. Please check the release notes for the latest 2.3.X version if there were some fixes for your problem since 2.3.2.
-aj
Problem solved by replacing BTree with Z 2.5.0 version. Thanks, Johan Carlsson
Cool... I would not have expected this to work :-) -aj ----- Original Message ----- From: "Johan Carlsson [Torped]" <johanc@torped.se> To: "Andreas Jung" <andreas@andreas-jung.com>; <zope-dev@zope.org> Sent: Monday, March 25, 2002 05:33 Subject: [Zope-dev] Re: [Zope] range:min bug in ZCatalogs fo Zope 2.3.2
At 05:45 2002-03-22 -0500, Andreas Jung wrote:
BTrees were rewritten in 2.4.0 so I assume you will run into problems. Please check the release notes for the latest 2.3.X version if there were some fixes for your problem since 2.3.2.
-aj
Problem solved by replacing BTree with Z 2.5.0 version.
Thanks, Johan Carlsson
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Andreas Jung wrote:
Cool... I would not have expected this to work :-)
IIRC, the range fix was one of the last maintenance tasks on the old Components/BTree package before it was deprecated in favour of the new Zope/BTrees implementation. -- Steve Alexander
participants (4)
-
Andreas Jung -
Andreas Jung -
Johan Carlsson [Torped] -
Steve Alexander