public virtual Explanation Explain(IndexReader indexReader, int docid, Explanation innerExplaination)
{
if (!(indexReader is BoboIndexReader)) throw new ArgumentException("IndexReader is not BoboIndexReader");
BoboIndexReader reader = (BoboIndexReader)indexReader;
Explanation exp = new Explanation();
exp.Description = "FacetBasedBoost";
float boost = 1.0f;
foreach (var boostEntry in _boostMaps)
{
string facetName = boostEntry.Key;
IFacetHandler handler = reader.GetFacetHandler(facetName);
if (!(handler is IFacetScoreable))
throw new ArgumentException(facetName + " does not implement IFacetScoreable");
IFacetScoreable facetScoreable = (IFacetScoreable)handler;
BoboDocScorer scorer = facetScoreable.GetDocScorer(reader, _scoringFunctionFactory, boostEntry.Value);
float facetBoost = scorer.Score(docid);
Explanation facetExp = new Explanation();
facetExp.Description = facetName;
facetExp.Value = facetBoost;
facetExp.AddDetail(scorer.Explain(docid));
boost *= facetBoost;
exp.AddDetail(facetExp);
}
exp.Value = boost;
exp.AddDetail(innerExplaination);
return exp;
}