ilivewithian
ilivewithian

Reputation: 19702

How stale are my indexes in Raven?

Is there a way to query a RavenDB document store and find out how stale any stale indexes are?

Essentially, what I'd like to do is provide results back to a user, but also give them some notion of how much indexing is left to complete.

This would be nice in large data import scenarios.

Upvotes: 4

Views: 428

Answers (1)

Ayende Rahien
Ayende Rahien

Reputation: 22956

Certainly, you can do it like this:

 RavenQueryStatistics stats;
 session.Query<Posts>()
      .Statistics(out stats)
      .Where(x=>x.Date <= DateTime.Today)
      .ToList();

The stats contains whatever the index is stale or not, and there is a property there that tells you what is the last update date for the index.

Upvotes: 5

Related Questions