[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zope
Subject:    Re: [Zope] ZCatalog : Searching Multiple Indexes : Returning One
From:       "Tom Von Lahndorff" <tom () modscape ! com>
Date:       2008-07-09 15:27:28
Message-ID: fcb5f13a0807090827v1228eda2v7079b1c6264b4a48 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@magma.ca> wrote:

>
> ----- Original Message ----- From: "Tom Von Lahndorff" <tom@modscape.com>
> To: "zope list user" <zope@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
>
>

[Attachment #5 (text/html)]

<br>If I understand correctly, this seems like searching for multiple values in one \
index. What I&#39;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.<br> <br><div \
class="gmail_quote">On Mon, Jul 7, 2008 at 4:00 PM, Jonathan &lt;<a \
href="mailto:dev101@magma.ca">dev101@magma.ca</a>&gt; wrote:<br><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;"> <br>
----- Original Message ----- From: &quot;Tom Von Lahndorff&quot; &lt;<a \
                href="mailto:tom@modscape.com" \
                target="_blank">tom@modscape.com</a>&gt;<br>
To: &quot;zope list user&quot; &lt;<a href="mailto:zope@zope.org" \
                target="_blank">zope@zope.org</a>&gt;<br>
Sent: Monday, July 07, 2008 3:42 PM<br>
Subject: [Zope] ZCatalog : Searching Multiple Indexes : Returning One \
Result<div><div></div><div class="Wj3C7c"><br> <br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); \
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Hi, I have a catalog called \
&quot;catalog&quot; that contains a bunch of cataloged<br> items. I have indexed 3 \
properties for each item, &quot;name&quot;, &quot;body&quot; and<br> \
&quot;description&quot;. I&#39;d like to be able to search the catalog in the \
following<br> way:<br>
<br>
if the word &quot;text&quot; shows up in any index, &quot;name&quot;, \
&quot;body&quot; or &quot;description&quot;,<br> return that result back once.<br>
<br>
The problem is I have is that if a do a search for &quot;text&quot; and say \
there&#39;s<br> results that have the word &quot;text&quot; in one or more of those \
indexes:<br> <br>
catalog({name:query}) or catalog({body:query}) or<br>
catalog({description:query})<br>
only gives back limited results (leaves out some &#39;True&#39; hits) and:<br>
catalog({name:query}) + catalog({body:query}) + catalog({description:query})<br>
gives me back the same result 3 times.<br>
<br>
any ideas? Thanks.<br>
</blockquote>
<br></div></div>
Something I saved from a long time ago post (warning untested) which may give you \
some ideas:<br> <br>
&lt;snip&gt;<br>
context.Catalog({&#39;keywordindex&#39;: [&#39;Value1&#39;, &#39;Value2&#39;]})<br>
Catalog returns me an OR search instead of an AND one<br>
<br>
Use &quot;context.Catalog(keywordindex = {&#39;query&#39;:[...], \
operator=&#39;and&#39;})&quot;<br> when you want to use the &quot;and&quot; \
operator.<br> &lt;/snip&gt;<br>
<br>
hth<br><font color="#888888">
<br>
Jonathan<br>
<br>
</font></blockquote></div><br>



_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic