We have added a property that let us add debugQuery=true
as option when querying Solr from our application. Sometimes the queries can be complex, so we need to see what parts of the query takes time. However I have not been able to find any good way to get the response from Solr without using ISolrConnection.Get()
and build up the query manualy (and getting the raw XML). Today we do like this:
var solr = ServiceLocator.Current.GetInstance<ISolrOperations<SolrDocument>>();
var qo = new QueryOptions();
qo.AddFilterQueries(AuthorizationIncludeQuery(solrQueryParameter.AccessibleDocuments));
qo.AddFilterQueries(new SolrQuery("person_id:" + solrQueryParameter.PersonId));
qo.Start = solrQueryParameter.Start;
qo.Rows = solrQueryParameter.Rows;
qo.Fields = new[] { "*", "score" };
if (Constants.SolrDebugEnabled)
{
var debugParams = new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("debugQuery", "true") };
qo.ExtraParams = debugParams;
}
try
{
return solr.Query(searchQuery, qo);
}
Since we use ISolrOperations<T>
and return SolrQueryResults<T>
The extra parameters gets "lost" in the process. Any way to read out the extra parameters without too much rewriting?