[Zope-dev] more on keyword indexes
Steve Alexander
steve@cat-box.net
Fri, 15 Dec 2000 12:36:38 +0000
Hi Josh,
I use KeywordIndexes a lot.
Just for kicks, I implemented what you describe below in Zope2.3 grabbed
fresh from CVS just now.
I used DTML Documents for the objects to catalog, and I added a lines
property called KW to each one.
I queried the catalog using syntax like
<dtml-in "Catalog(KW=['one', 'two'])">
or
<dtml-in "Catalog(KW='purple')">
Josh Zeidner wrote:
> Hello,
>
> I did a little more investigiation into the problem, and couldnt really
> find any documentation anywhere on what the actual semantics are of keywords
> and how they are queried. For instance:
>
> I have three classes and each has an keyword index named KW:
>
> ObjectOne: KW = ['one','blue','furry']
> ObjectTwo: KW = ['two','flying','purple']
> ObjectThree: KW = ['three','one-eyed','purple']
>
> If I were to query the ZCatalog with the following set of words:
> ['purple'] I would expect to get:
>
> ObjectTwo
> ObjectThree
Yes, that's what you get.
> Right? If I query the database with ['one','two'] ( if this type of thing
> is at all possible ), I get :
>
> ObjectOne
> ObjectTwo
Yes, that's what you get.
> This seems like the obvious result: BUT: it depends if you want a AND/OR
> type search.
It is an OR search.
> I could also expect to get nothing( if its an AND type search
> because no records match 'one' and 'two' ). Here is better example, what if
> I queried: ['purple','one-eyed']. Would I be expecting only ObjectThree or
> [ ObjectThree, ObjectTwo ] ( because they both match the keyword purple( a
> logical set-intersection ) ).
You get ObjectTwo and ObjectThree.
> Also I found the keyword indexes to have some more obvious bugs. If I
> only used one keyword for the matching critiria, for instance if I used
> 'purple' , I would only get ObjectTwo.
I get ObjectTwo and ObjectThree, as I'd expect.
> Is anyone else using keyword
> indexes? In what way are you using them?
All sorts of things. One useful use is to limit a query on a SiteIndex
type of catalog to just a sub-tree of your site.
See my message to zope-dev on October:
http://lists.zope.org/pipermail/zope-dev/2000-October/007535.html
--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net