Say I have nodes stored in Jackrabbit JCR repository where they have multiple 'tag' properties attached.
I want to perform an or query, where any nodes that have tags with any of the tags in the query are returned. But I want them ordered by number of matches. So a node with all OR conditions matching will be on top, and one matching just one will be last.
I guess this is same as this suggestion here: https://stackoverflow.com/a/3289152/303106
But AFAIK, we don't have CASE constructs in SQL2. Neither do I know of anything equivalent in XPATH.
So how do I achieve the same result (other then post processing at application level, which I'd prefer to avoid due to performance issues).
I hope this will help you to execute the query: