[EMAIL PROTECTED] (Josh Harding) writes:
> Dan Mosedale wrote:
> > 
> > Paul Sandoz <[EMAIL PROTECTED]> writes:
> > >
> > >       Example:
> > >
> > >       (name == "X" && nickname == "Y") ||
> > >       (email 'contains' "ZSxsxZ" || !(fax="123"))
> > >
> > >       Note sure how to do it beyond creating interfaces to
> > >       cater for statements and operators i.e. defining
> > >       a binary tree representing the statement where the
> > >       nodes are operations. Not sure i am using the correct
> > >       terminology but you see these types of things
> > >       when looking at compiler books, if one feels
> > >       so inclined, when referring to parsing statements.
> > 
> > I think the term you're looking for is "expression" rather than
> > statement.  And yeah, a binary tree sounds like just the right
> > representation.
> 
> This would be a wonderful improvement.  So each leaf node would be a
> condition (i.e. a field name and a value), and each non-leaf node would
> be an operator (e.g. AND or OR).  So far, this sounds good.  Now how
> about adding operators like XOR.  I could see that working, but in
> practice, XOR probably wouldn't be so useful... rather you might want a
> custom operator that says "return True iff exactly one of an entire
> group of conditions is true".  I don't think it would be possible to
> implement this type of operator using a strictly binary tree... it would
> need to be a tree structure that allows for more than two child
> nodes. 

Good point.  Lisp's operator functions work this way.

> This would also make the internal representation more similar to the way
> it would be displayed in the GUI (where a binary tree would require a
> slightly different internal representation).  If I'm not clear on this
> point, I can write up an example.

It would be interesting to see any GUI ideas you have.

To be clear, though, we're talking about searching in addressbooks at
this point, not mail filters.  And it seems likely that this isn't
worth worrying about UI for, at least initially, since I suspect that
only real power-users (or other clients of the directory search code)
are going to need or want to do sophisticated addressbook searches.

Dan
-- 

Reply via email to