Josh Zeidner wrote:

> Hi,
>   Currently I am wrestling with "keyword" indexes in ZCatalogs.  How do I
> query the ZCatalog for all records of objects indexed on a particular
> keyword.  For instance if my index is named MediaKeyword ive tried:
>  <dtml-in "Catalog.searchResults( MediaKeywords = ['ouch'] )">

That should work.

>    this has completely unpredictable results.
>  <dtml-in "Catalog.searchResults( MediaKeywords in ['ouch'] )">
>    this returns all indexed objects!

That won't work. The python

   MediaKeywords in ['ouch']

will be evaluated first, and will give a calue of 0 or 1. If 
MediaKeywords is a list, then it will always give 0, because there is 
only one item in ['ouch'], and that is the string 'ouch'.

>   What am I doing wrong?  Is there a special ZCatalog function for querying
> keyword indexes?  I need some insight into this problem.

Are you sure that the keywords are being indexed in your catalog? A good 
trick is to index the keyword attribute, and also store it as metadata. 
That way, you can look through your search results at the keywords the 
Catalog thinks you have.

Also, check that you declared MediaKeywords as a keyword index, and that 
the MediaKeywords attribute in your objects is (or returns) a sequence 
type such as a tuple or a list.

Steve Alexander
Software Engineer
Cat-Box limited

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to