Session: Querying: Debugging: How to include Query Explanations

includeExplanations allows to investigate details related to score assigned for each query result.

Syntax

IDocumentQuery<T> IncludeExplanations(out Explanations explanations);

Example

var syrups = session.Advanced.DocumentQuery<Product>()
    .IncludeExplanations(out Explanations explanations)
    .Search(x => x.Name, "Syrup")
    .ToList();

string[] scoreDetails = explanations.GetExplanations(syrups[0].Id);
var syrups = await session.Advanced.AsyncDocumentQuery<Product>()
    .IncludeExplanations(out Explanations explanations)
    .Search(x => x.Name, "Syrup")
    .ToListAsync();

string[] scoreDetails = explanations.GetExplanations(syrups[0].Id);
from Products 
where search(Name, 'Syrup')
include explanations()

Sample explanation:

4.650658 = (MATCH) fieldWeight(search(Name):syrup in 2), product of:
  1 = tf(termFreq(search(Name):syrup)=1)
  4.650658 = idf(docFreq=1, maxDocs=77)
  1 = fieldNorm(field=search(Name), doc=2)