If you execute LuceneQuery, you get a returned DocumentQuery that has a QueryResult property that contains TotalResults, so you can access it like this:
var documentQuery = (from mdl in query dbSession.LuceneQuery<MyModel>("MyIndex") orderby mdl.Name select dept).Skip(page.Value).Take(4); var totalResults = documentQuery.QueryResult.TotalResults;
If you are executing a LINQ query, then you can call Count () on the query before restricting it by clicking the Skip and Take buttons:
var linqQuery = (from mdl in query dbSession.Query<MyModel>("MyIndex") orderby mdl.Name select dept); var totalResults = linqQuery.Count(); var pageOfResults = linqQuery.Skip(page.Value).Take(4);
source share