The last big feature for RavenDB 4.0 has landed, and it is a big one. You can see the details on the PR that implemented this feature below, but you probably care a lot more about what it is.
RavenDB uses Lucene as the underlying index technology, and until now we simply exposed (slightly modified) Lucene syntax to our clients. That was easy to do and quite effective, but it also meant that we were limited to somewhat arcane query language and what it could do.
In RavenDB 4.0, we now have a full query language, and you can see how this looks like below:
This will be produce the results that you expect, giving you all the companies residing in London in the database.
The rest of the system behaves just the same, this query is going to hit the query optimizer, and index will be created if one does not already exists, etc. It is just that our query language is both much nicer to look at and allow us to work with it in a much more structured manner (and yes, that is a pun).
We also support aggregation:
This is automatically creating a map/reduce index and does all the work for you. We also have support for querying on indexes directly via:
If you are familiar with how we used to have to do range queries, you can see how big an improvement this is. This is actually a pretty significant feature, because you can define a static index to do whatever you want with the data, and then query on top of that.
You can also do the usual full text operations directly in the query language:
We decide to go with the method abstraction for most operations, because it allows us a lot of freedom in the syntax and give very readable queries.
Here is an example of us trying a more complex query. In this one, I want to find companies in London, the UK or France. But instead of just wanting to find them in that particular order, I want to get them with ranking.
I really want a company in London, so that should sort first, and then UK based companies and finally France companies. You can see the results of the query below. This query also show have we can do projections, in a much nicer way.
The feature just landed in the main branch and we are now working through all of the rough edges, but it is very exciting, since it give you a natural way to query RavenDB without losing any of the power.
I mentioned that this was a big change, right?
And that is just for the C# work, we still have to update the other clients.