On Friday 29 March 2002 11:52 pm, kedai@kedai.com.my wrote:
zope 2.5.1b1 in pythonscript, concat the result of the query like so
o=getattr(context,'Catalog') r=o(index1={'query':'myquery'}) + o(index2={'query':'query2'}) return r
there maybe better ways, but thsi is how i did it
this works, but adds some extra overhead as you go through the entire zcatalog query process several times. you can search a catalog on multiple indexes by passing each index name and its query args as keyword names to
the
catalog... ie for a simple case the above translates to
o(index1=query, index2=query2)
this is how i did it with zope 2.3.x
i spoke to aj, and if i get it correctly, that way is deprecated. he ssays maybe zope 2.9, that code will break :)
i asked andreas to clarify this since i found it a little strange in zope2.5 the preferred manner to search an index is to pass in a querydictionary containing the query and index usage options. as catalog(index1={'query':'foo', 'index_option1':'value'}) the older method of passing in the query as keyword value directly to the catalog is still supported (in that it doesn't raise a depreciation warning). but this doesn't have anything to do with multi-index searches, it just a means for specifiying the query to an index. so for zope2.5 the preferred multi-index search syntax would be. results = catalog(index1=querydict1, index2=querydict2) cheers kapil
thus the full catalog search machinery is invoked only once and internally (and more efficiently) the catalog will merge the results
as per the original question, use a python script to break up the form
input
appropriately to search the individual indexes.
-kapil \