Hi Steve, Yes Im sure it is being indexed as I have set the MetaData as you described. It seems to be indexed as expected. Basically, what I am trying to do is set up keyword relationships so that I can present related links to the user( someone implied that this is the reason keywords were invented in the first place ). Are there any such examples on the web right now? -josh 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 http://www.cat-box.net