RE: [Zope-dev] ZCatalog searching for missing values
Having an exists function would be great. I was trying to do the same using CatalogQuery, but I found no way to check for Missing.Value, which is the repr() of what's in the catalog's metadata field for objects that don't have that attribute/function. I also ran into problems doing more complex or'ing and and'ing, and I assume we'll have better luck with ZOQLMethod for that. I just tried out ZOQLMethod as well. Couldn't get it to work, but it looks like really solid craftsmanship. I like the user-friendly way of selecting base object and the complete syntax. :) Some questions: 1. I couldn't get any query to work. I keep getting exceptions.TypeError argument 2 to map() must be a sequence object Here's an example query that I've tried SELECT id WHERE title == '' RECURSIVE; 2. Is the ZCatalog searching implemented? How do I activate it? 3. Do you have any plans to implement JOIN? The exists function would be very cool. Keep up the great work. Hope this helps flush out some features :) Bye, -- Bjorn Stephan wrote: [...]
I actually need to look at Casey's code and see what I can reuse. The efficiency of my version is not that great yet, but much more flexible. So I want to take Casey's code and optimize mine a little.
BTW, I just added a mailing list and a poll for ZOQL. Please go to http://demo.iuveno-net.de/iuveno/Products/ZOQLMethod and vote in the poll, so I can get an estimate of the general interest.
I have one question: is it possible using a normal catalog query or Kavio's catalog query to check if a value is not set? The representation returned is Missing.Value, but I seem to be unable to say, e.g, 'Description == Missing.Value' etc. How hard is it to add such functionality?
You mean, whether the system checks, if a property exists at all or is set to None? I think both would be no problem.
1. Property exists or not:
I could support a function, like: exists(Property) Example:
SELECT * FROM Test WHERE exists(Property);
2. Property is set to None:
Simply use equal: Property == None Note: That might work already? I have to check... Example:
SELECT * FROM Test WHERE Property == None;
Regards, Stephan
-- Stephan Richter CBU - Physics and Chemistry Student Web2k - Web Design/Development & Technical Project Management
_______________________________________________ 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 )
I just tried out ZOQLMethod as well. Couldn't get it to work, but it looks like really solid craftsmanship. I like the user-friendly way of selecting base object and the complete syntax. :) Some questions:
1. I couldn't get any query to work. I keep getting
exceptions.TypeError argument 2 to map() must be a sequence object
Solved. See below.
Here's an example query that I've tried
SELECT id WHERE title == '' RECURSIVE;
You can only select meta types (this is by design; I just don't want to deal with brains and all that stuff right now.)!! Did you see the help? It has a long example in there as well. But there is another bug. You have to specify FROM right now. I will fix that. Okay, is fixed for the next release. So, SELECT "DTML Method" FROM "." WHERE title == '' RECURSIVE; should work.
2. Is the ZCatalog searching implemented? How do I activate it?
Yes, see the "Rather Lengthy Example".
3. Do you have any plans to implement JOIN?
No, for the reasons given above. You select only objects, not attributes. BUT, patches are always welcomed!!! :-)
The exists function would be very cool.
I will look into this. Hopefully it will be not too hard to implement.
Keep up the great work. Hope this helps flush out some features :)
I hope I will. :-) Yes it does. If you and all the other Zope people could write me some arguments to support attribute selection, then I will look into it (but it will be not that easy). Regards, Stephan -- Stephan Richter CBU - Physics and Chemistry Student Web2k - Web Design/Development & Technical Project Management
participants (2)
-
Bjorn Stabell -
Stephan Richter