Given the current way [Riak] index queries are expressed, I was reminded of the unfortunately named HTSQL; I'm not sure if I am fond of it or not yet, but I thought I'd pass along a few references as it bears some at least superficial similarity to what exists in Riak at the moment, and that may be of use: