You are currently browsing legacy 2.5 version of documentation. Click here to switch to the newest 4.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Query customizations

Raven's Query has a bunch of customizations which you can set by using Customize() method. Example:

session.Query<User>().Customize(x => x.WaitForNonStaleResultsAsOfLastWrite());

Below there are presented available query customization options. All of them have equivalents for LuceneQuery. In example the Lucene version of the query above would be:

session.Advanced.LuceneQuery<User>().WaitForNonStaleResultsAsOfLastWrite();

NoCaching

It disables the caching for query results. It means that a response of a request send to get results of a specified query will not be keep in the cache.

session.Query<User>().Customize(x => x.NoCaching());

NoTracking

It disables the tracking mechanism for queried entities by Raven's Unit of Work. The usage of this option will prevent holding query results in memory.

session.Query<User>().Customize(x => x.NoTracking());