You will add a new code snippet to the Main()
method of the RavenDB_Ch04
to check if an index result is stale or not.
Open the
RavenDB_Ch04
project in Visual Studio.Add the following code to the
Main()
method:Save all the files, build and run the solution.
Check the output window for the stale status of the index result.
You added the necessary code to the Main()
method to check stale index result.
In order to perform stale index result checking, you first declare a new RavenQueryStatistics
variable that will hold the query statistics information about the query and the index such as the IndexName
, and the TotalResults
which indicates the total query results documents count (line 190).
Then, we query the index using the Query()
method on the Session
instance object and specify the index name to check (line 191). To get back the query statistics, we call the Statistics()
method (lines 192).
In this query you don't need to retrieve...