Alvaro Herrera wrote:
In fact, parsing this SQL dialect would just be the first step, as the
annotations within the query induce an ordering of the result set.
Huh, what is this supposed to be able to do that you can't do with the
already existing ORDER BY clause?
Basically, conditional statements are annotated with integers that
represent weights, like
(...)WHERE (foo = 'a')[42] OR (bar = 'b')[20]
In the result set those entries that fulfill both conditions yield score
62, i.e. 42+20, and are ranked top, whereas entries that fulfill only
one of the conditions yield scores 42 and 20 respectively and are
therefore ranked lower.
Honestly, I'm only the poor student who has to implement what the
smarter ones have thought out. ;)
And, yes, it is possible to accomplish the desired sorting with the
ORDER BY clause, but as conditions become more complex, the self cooked
dialect is considered to be more readable and intuitive to the end user.
Regards,
Matthias