> Chris:
> I am working on getting a decent query language for ZCatalog/Catalog and

Very cool...

> I have been able to make good progress, however I am running into a bit
> of an issue that I thought you might know something about:
> In order to implement a "!=" query operator, I am trying to do the
> following:


> >From the index, return the result set that match the value (easy)
> Subtract that from the set of all items in the index (not so easy)
> I see that there is the difference method available from IIBTree,
> however I seem to be unable to use it on the entire index (Which is an
> OOBTree and not really a set I guess). Here is a snippit of my code
> which doesn't work:
> if op == '!=' or op[:3] == 'not':
> w, rs = difference(index._index, rs) # XXX Not a warm fuzzy...
> (where rs is the index result set that matches the value and index is
> the Catalog index OOBTree)
> What can I supply for the first argument to get a set of all items in
> the index, or is there any easier and better approach to this whole
> issue?

Well.. I assume that _index is the forward data structure of a FieldIndex.
In this case, you could get the info you want (a list of all document ids in
the index) from _unindex.keys(), as _index and _unindex are mirror images of
each other that need to be kept in sync... I think what comes back is a
BTreeItems object.  I think this is usable in conjunction with the resultset
IISet (also a list of document ids) via the difference function... I haven't
tried it, though...

> BTW: I realize I could step though _index.items() and create an IISet
> but that seems awful inefficient...

Yeah, that'd be terrible.

This is a tricky operator.  I can't really wrap my head around using it in
conjunction with parens.  Then again, maybe you wouldn't...


- C

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

Reply via email to