RE: [Zope-dev] intersection of ZCatalog queries on the same index

2000-10-05 Thread Neil K

Michel Pelletier <[EMAIL PROTECTED]> wrote:

> Catalog.searchResults({'food', ['foo', 'bar']})
   ^
I think you meant a : there?  
 

> would find all of the objects whose food property contained both 'foo'
> _and_ 'bar'.
   
This is not returning the intersection but the union. At least for me.

On the other hand, full-text searches appear to handle a phrase 
like 'foo and bar'. 

--
Neil Kandalgaonkar  <[EMAIL PROTECTED]>
Web Application Developer, ActiveState

 

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] intersection of ZCatalog queries on the same index

2000-10-05 Thread Michel Pelletier

Neil K wrote:
> 
> If there a way to get ZCatalog to give me intersections of results on a
> single index? All the examples and tutorials I've seen are union (OR)
> queries.
> 
> Basically I just want ZCatalog to give me items where keywords contained
> both 'foo' and 'bar'.

You should use a Keyword Index for this.  If your KW index was named
'food' and all your objects had a 'food' sequence attribute, then:

Catalog.searchResults({'food', ['foo', 'bar']})

would find all of the objects whose food property contained both 'foo'
_and_ 'bar'.

> I have browsed through Catalog.py and it seems like it might be possible.
> Disclaimer, I'm pretty new to Zope & python.

In the general case, it's not possible without redesigning Zope's
catalog query language (which implicitly ORs all index queries
together).  For the special case of keywords, use a keyword index.

-Michel

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )