[Zope] ZCatalog : Searching Multiple Indexes : Returning One Result

Tom Von Lahndorff tom at modscape.com
Wed Jul 9 11:27:28 EDT 2008


If I understand correctly, this seems like searching for multiple values in
one index. What I'm looking to do is search for one value in multiple
indexes... and get back one result even if there are True hits in more than
one index.

On Mon, Jul 7, 2008 at 4:00 PM, Jonathan <dev101 at magma.ca> wrote:

>
> ----- Original Message ----- From: "Tom Von Lahndorff" <tom at modscape.com>
> To: "zope list user" <zope at zope.org>
> Sent: Monday, July 07, 2008 3:42 PM
> Subject: [Zope] ZCatalog : Searching Multiple Indexes : Returning One
> Result
>
>
>
>  Hi, I have a catalog called "catalog" that contains a bunch of cataloged
>> items. I have indexed 3 properties for each item, "name", "body" and
>> "description". I'd like to be able to search the catalog in the following
>> way:
>>
>> if the word "text" shows up in any index, "name", "body" or "description",
>> return that result back once.
>>
>> The problem is I have is that if a do a search for "text" and say there's
>> results that have the word "text" in one or more of those indexes:
>>
>> catalog({name:query}) or catalog({body:query}) or
>> catalog({description:query})
>> only gives back limited results (leaves out some 'True' hits) and:
>> catalog({name:query}) + catalog({body:query}) +
>> catalog({description:query})
>> gives me back the same result 3 times.
>>
>> any ideas? Thanks.
>>
>
> Something I saved from a long time ago post (warning untested) which may
> give you some ideas:
>
> <snip>
> context.Catalog({'keywordindex': ['Value1', 'Value2']})
> Catalog returns me an OR search instead of an AND one
>
> Use "context.Catalog(keywordindex = {'query':[...], operator='and'})"
> when you want to use the "and" operator.
> </snip>
>
> hth
>
> Jonathan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080709/15f5764e/attachment.html


More information about the Zope mailing list