[Zope] Searching Multiple Fields in ZCatalog

Bak @ kedai kedai@kedai.com.my
Sat, 30 Mar 2002 15:52:09 +0800


>> 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 :)

>
>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
>
>_______________________________________________
>Zope maillist  -  Zope@zope.org
>http://lists.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>