本文整理汇总了C#中Lucene.Net.Search.Explanation类的典型用法代码示例。如果您正苦于以下问题:C# Explanation类的具体用法?C# Explanation怎么用?C# Explanation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Explanation类属于Lucene.Net.Search命名空间,在下文中一共展示了Explanation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Explain
public override Explanation Explain(int doc)
{
Explanation explanation = new Explanation();
explanation.SetValue(1.0f);
explanation.SetDescription("MatchAllDocsQuery");
return explanation;
}
示例2: Explain
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;
}
示例3: Explain
public virtual Explanation Explain(int df, float boost)
{
Explanation expl = new Explanation();
expl.Value = Score(df, boost);
expl.Description = "facet boost value of: " + boost;
return expl;
}
示例4: Explain
public virtual Explanation Explain(IndexReader reader, int doc, Explanation innerExplanation)
{
if (reader is BoboIndexReader)
{
BoboIndexReader boboReader = (BoboIndexReader)reader;
object dataObj = boboReader.GetFacetData(_timeFacetName);
if (dataObj is FacetDataCache)
{
FacetDataCache facetDataCache = (FacetDataCache)(boboReader.GetFacetData(_timeFacetName));
BigSegmentedArray orderArray = facetDataCache.OrderArray;
TermLongList termList = (TermLongList)facetDataCache.ValArray;
long now = System.Environment.TickCount;
Explanation finalExpl = new Explanation();
finalExpl.AddDetail(innerExplanation);
float rawScore = innerExplanation.Value;
long timeVal = termList.GetPrimitiveValue(orderArray.Get(doc));
float timeScore = ComputeTimeFactor(timeVal);
float finalScore = CombineScores(timeScore, rawScore);
finalExpl.Value = finalScore;
finalExpl.Description = "final score = (time score: " + timeScore + ") * (raw score: " + rawScore + "), timeVal: " + timeVal;
return finalExpl;
}
else
{
throw new InvalidOperationException("underlying facet data must be of type FacetDataCache<long>");
}
}
else
{
throw new ArgumentException("reader not instance of " + typeof(BoboIndexReader));
}
}
示例5: Explain
public override Explanation Explain(IndexReader reader, int doc)
{
Explanation result = new Explanation();
result.Value = _weight;
result.Description = _parent.ToString();
return result;
}
示例6: Explain
/// <summary>Explain the score of a document.</summary>
/// <todo> Also show the total score. </todo>
/// <summary> See BooleanScorer.explain() on how to do this.
/// </summary>
public override Explanation Explain(int doc)
{
Explanation res = new Explanation();
res.SetDescription("required, optional");
res.AddDetail(reqScorer.Explain(doc));
res.AddDetail(optScorer.Explain(doc));
return res;
}
示例7: Explain
public virtual Explanation Explain(params float[] scores)
{
float sum = 0.0f;
foreach (float score in scores)
{
sum += score;
}
Explanation expl = new Explanation(sum, "sum of: " + Arrays.ToString(scores));
return expl;
}
示例8: Explain
public override Explanation Explain(IndexReader reader, int doc)
{
ComplexExplanation result = new ComplexExplanation();
result.SetDescription("weight(" + GetQuery() + " in " + doc + "), product of:");
System.String field = ((SpanQuery) GetQuery()).GetField();
Explanation idfExpl = new Explanation(idf, "idf(" + field + ": " + idfExp.Explain() + ")");
// explain query weight
Explanation queryExpl = new Explanation();
queryExpl.SetDescription("queryWeight(" + GetQuery() + "), product of:");
Explanation boostExpl = new Explanation(GetQuery().GetBoost(), "boost");
if (GetQuery().GetBoost() != 1.0f)
queryExpl.AddDetail(boostExpl);
queryExpl.AddDetail(idfExpl);
Explanation queryNormExpl = new Explanation(queryNorm, "queryNorm");
queryExpl.AddDetail(queryNormExpl);
queryExpl.SetValue(boostExpl.GetValue() * idfExpl.GetValue() * queryNormExpl.GetValue());
result.AddDetail(queryExpl);
// explain field weight
ComplexExplanation fieldExpl = new ComplexExplanation();
fieldExpl.SetDescription("fieldWeight(" + field + ":" + query.ToString(field) + " in " + doc + "), product of:");
Explanation tfExpl = Scorer(reader, true, false).Explain(doc);
fieldExpl.AddDetail(tfExpl);
fieldExpl.AddDetail(idfExpl);
Explanation fieldNormExpl = new Explanation();
byte[] fieldNorms = reader.Norms(field);
float fieldNorm = fieldNorms != null?Similarity.DecodeNorm(fieldNorms[doc]):1.0f;
fieldNormExpl.SetValue(fieldNorm);
fieldNormExpl.SetDescription("fieldNorm(field=" + field + ", doc=" + doc + ")");
fieldExpl.AddDetail(fieldNormExpl);
fieldExpl.SetMatch(tfExpl.IsMatch());
fieldExpl.SetValue(tfExpl.GetValue() * idfExpl.GetValue() * fieldNormExpl.GetValue());
result.AddDetail(fieldExpl);
System.Boolean? tempAux = fieldExpl.GetMatch();
result.SetMatch(tempAux);
// combine them
result.SetValue(queryExpl.GetValue() * fieldExpl.GetValue());
if (queryExpl.GetValue() == 1.0f)
return fieldExpl;
return result;
}
示例9: ExplanationDialog
public ExplanationDialog(Explanation e)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
treeExplain.BeginUpdate();
AddNode(null, e);
treeExplain.ExpandAll();
treeExplain.EndUpdate();
}
示例10: Explain
public virtual Explanation Explain(params float[] scores)
{
Explanation expl = new Explanation();
float boost = 1.0f;
foreach (float score in scores)
{
boost *= score;
}
expl.Value = boost;
expl.Description = "product of: " + Arrays.ToString(scores);
return expl;
}
示例11: Explain
public override Explanation Explain(int doc)
{
Explanation res = new Explanation();
if (exclScorer.SkipTo(doc) && (exclScorer.Doc() == doc))
{
res.SetDescription("excluded");
}
else
{
res.SetDescription("not excluded");
res.AddDetail(reqScorer.Explain(doc));
}
return res;
}
示例12: Explain
public override Explanation Explain(int doc)
{
Explanation tfExplanation = new Explanation();
while (Next() && Doc() < doc)
{
}
float phraseFreq = (Doc() == doc)?freq:0.0f;
tfExplanation.SetValue(GetSimilarity().Tf(phraseFreq));
tfExplanation.SetDescription("tf(phraseFreq=" + phraseFreq + ")");
return tfExplanation;
}
示例13: Explain
public override Explanation Explain(int doc)
{
// make sure it has minX and area
if (validMinX.Get(doc) && validMaxX.Get(doc))
{
Rectangle rect = new RectangleImpl(
minX[doc], maxX[doc],
minY[doc], maxY[doc]);
var exp = new Explanation();
_enclosingInstance.similarity.Score(rect, exp);
return exp;
}
return new Explanation(0, "No BBox");
}
示例14: Explain
public override Explanation Explain(IndexSearcher searcher, Explanation firstPassExplanation, int docID)
{
Explanation result = base.Explain(searcher, firstPassExplanation, docID);
IList<AtomicReaderContext> leaves = searcher.IndexReader.Leaves;
int subReader = ReaderUtil.SubIndex(docID, leaves);
AtomicReaderContext readerContext = leaves[subReader];
int docIDInSegment = docID - readerContext.DocBase;
var context = new Dictionary<string, object>();
var fakeScorer = new FakeScorer { score = firstPassExplanation.Value, doc = docIDInSegment };
context["scorer"] = fakeScorer;
foreach (string variable in expression.variables)
{
result.AddDetail(new Explanation((float)bindings.GetValueSource(variable).GetValues
(context, readerContext).DoubleVal(docIDInSegment), "variable \"" + variable + "\""
));
}
return result;
}
示例15: Score
public double Score(Rectangle indexRect, Explanation exp)
{
double score;
if (indexRect == null)
{
score = nullValue;
}
else
{
score = distCalc.Distance(queryPoint, indexRect.GetCenter());
}
if (exp != null)
{
exp.Value = (float) score;
exp.Description = GetType().Name;
exp.AddDetail(new Explanation(-1f, "" + queryPoint));
exp.AddDetail(new Explanation(-1f, "" + indexRect));
}
return score;
}