[Zope] Re:searching ZCatalog from Python Script - please read first!

aZaZel azazel@planningsrl.it
Thu, 15 Feb 2001 03:40:05 +0100


On Wed, 14 Feb 2001 16:17:34 +0000
Sandy Britain <a.britain@bangor.ac.uk> wrote:

> Ooooops! OK I admit it - I'm too stupid to own a computer!
> 
> I've found my own obvious mistake - I had left a " out of my html in the dtml testing method which is why the %22
> got appended to the end of the URL -
> Doh!

fine :-)
> 
> so my question is a lot clearer:
> 
> running the python script on a Zcatalog -   return context.Catalog() - works fine and correctly returns all the
> entries in the catalog, but the script -  return context.Catalog({'x' : x, 'y' : y}) runs but doesn't return any
> results. I have quadruple checked
> my syntax (with the example) although I'm confused that I can't find the Catalog() method in the Zope API
> documentation. BTW the search keys and values definately do exist!
> 
> I must be doing something wrong, but I don't know what
> 
> Thanks in advance to anyone who can help,
> 
> Sandy.
> 


Are you searching against textindexes or fileindexes? Are you sure the values exist in the same zclass instance?

the Catalog isn't a method ...is a callable object , the object you placed on the zope tree.

Searching with the zcatalog isn't ever so obvius..

Some sources of information:


A well done how-to that has been written for dtml but the explained tecniques to call the catalog are the same in  python.
 
http://www.zope.org/Members/Zen/howto/AdvZCatalogSearching

A little explanation of the various index types

http://www.zope.org/Members/AlexR/KeywordIndexes

not only keyword indexes 

azazel