Slow query log
SlowQueryLog writes one JSON line per query that exceeds a latency threshold.
Wire it up
using Rowles.LeanLucene.Diagnostics;
using Rowles.LeanLucene.Search.Searcher;
using var slowLog = SlowQueryLog.ToFile(
thresholdMs: 50.0,
filePath: "./slow-queries.jsonl");
var config = new IndexSearcherConfig { SlowQueryLog = slowLog };
using var searcher = new IndexSearcher(dir, config);
Or write to any TextWriter:
var writer = new StringWriter();
var log = new SlowQueryLog(thresholdMs: 25.0, writer);
Log entry
Each line contains: Timestamp (UTC), QueryType, Query (string form),
ElapsedMs, TotalHits.
Reading entries
The file is JSON Lines. Parse each line with the schema above.