chriseldredge / Lucene.Net.Linq

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

Search Generated Query #94

Closed egorppv closed 8 years ago

egorppv commented 8 years ago

Can't find any way, how can I see generated query by lucene.net.linq. May be it is not a bug, but a good improvement could be.

chriseldredge commented 8 years ago

You can get the generated query by using LuceneQueryStatistics.Query.

Example:

LuceneQueryStatistics stats = null;

provider
  .AsQueryable<SampleDocument>()
  .CaptureStatistics(s => { stats = s; })
  .Where(d => d.SearchText == "foo")
  .Skip(20)
  .Take(20)
  .ToList();

var generatedQuery = stats.Query;