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

Jonathan dev101 at magma.ca
Mon Jul 7 16:00:51 EDT 2008


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



More information about the Zope mailing list