chriseldredge / Lucene.Net.Linq

LINQ provider to run native queries on a Lucene.Net index
Other
151 stars 66 forks source link

Feature: retrieve query hit count #64

Closed tamasflamich closed 10 years ago

tamasflamich commented 10 years ago

It would be nice if the Lucene query hit count could be retrieved when someone executes a query. My ideas is to provide the following query extension method:

public static IEnumerator<T> Execute<T>(this IQueryable<T> source, out int totalCount)
{
    var query = source as LuceneQueryable<T>;

    var provider = query.Provider as QueryProviderBase;
    var executor = provider.Executor as LuceneQueryExecutor<T>;
    var queryModel = provider.GenerateQueryModel(source.Expression);

    // TODO: finish
}

I started to implement this, however I realized soon that this would require massive refactoring of LuceneQueryExecutor.ExecuteCollection, so maybe it would be better to leave it for the author.

chriseldredge commented 10 years ago

Dupe of #23. Not sure when I'll get to this, but I had a similar idea of using an extension method to get access to statistics including total hits.

chriseldredge commented 10 years ago

Implemented in 389b965d706ba6edcf28c89e24da7984fbe56afd