2007/1/29, Jean-Francois Dockes <[EMAIL PROTECTED]>:

Mikkel Kamstrup Erlandsen writes:
> 2007/1/29, Jean-Francois Dockes <[EMAIL PROTECTED]>:
> >
> > Mikkel Kamstrup Erlandsen writes:
> > > Hi All,
> > >
> > > I put together a first take on formalizing an end user search
language.
> > >
> > > http://wiki.freedesktop.org/wiki/WasabiUserSearchLanguage
> >
> > - Which of OR and AND has priority ? (does (A AND B OR C) mean
> >    ((A AND B) OR C) or (A AND (B OR C)) ?
>
>
> I guess it is standard that AND takes precedence over OR, but maybe it
makes
> sense to reverse that in our case. Think of the case
> type:audio hendrix OR beatles
>
> In this case I would assume the user wants "audio files matching hendrix
or
> beatles", and not "audio files matching hendrix, or anything that
matches
> beatles"... I think it is non-standard however...


Thinking more about this operator precedence issue... What about

|| type:music jimi hendrix or beatles

If OR had precedence over AND that search would not yield the expected
results...

Maybe a solution would be to simple put selectors completely out of logical
scope with words and phrases. Always just AND them on to the expression.
That way the search:

|| type:music jimi hendrix or beatles filetype:mp3 or filetype:ogg

would give what is *probably* wanted...

A totally other approach would be to have AND take precedence and use "," to
separate expressions that should be ANDed together. Example:

|| type:music, jimi hendrix or beatles
|| type:music, jimi hendrix or beatles, filetype:mp3 or filetype:ogg

The last example translates to: (type:music) AND ((jimi AND hendrix) OR
beatles) AND (filetype:mp3 OR filetype:ogg)

I actually kinda like that. It keeps the conventional AND precedence and
allows simple grouping of expressions.

In our case, I think that you are right and that it makes more sense to
have OR take precedence, this has my vote.


Are you still of the same opinion?

Cheers,
Mikkel
_______________________________________________
xdg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xdg

Reply via email to