本文整理汇总了C#中Lucene.Net.Search.Explanation.SetDescription方法的典型用法代码示例。如果您正苦于以下问题:C# Explanation.SetDescription方法的具体用法?C# Explanation.SetDescription怎么用?C# Explanation.SetDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Search.Explanation
的用法示例。
在下文中一共展示了Explanation.SetDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: Explain
public override Explanation Explain(int doc)
{
Explanation explanation = new Explanation();
explanation.SetValue(1.0f);
explanation.SetDescription("MatchAllDocsQuery");
return explanation;
}
示例3: 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;
}
示例4: 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;
}
示例5: Explain
public virtual Explanation Explain(IndexReader reader, int doc)
{
ConstantScorer cs = (ConstantScorer) Scorer(reader);
bool exists = cs.bits.Get(doc);
Explanation result = new Explanation();
if (exists)
{
result.SetDescription("ConstantScoreQuery(" + Enclosing_Instance.filter + "), product of:");
result.SetValue(queryWeight);
result.AddDetail(new Explanation(Enclosing_Instance.GetBoost(), "boost"));
result.AddDetail(new Explanation(queryNorm, "queryNorm"));
}
else
{
result.SetDescription("ConstantScoreQuery(" + Enclosing_Instance.filter + ") doesn't match id " + doc);
result.SetValue(0);
}
return result;
}
示例6: Explain
/// <returns> An explanation for the score of a given document.
/// </returns>
public override Explanation Explain(int doc)
{
Explanation res = new Explanation();
System.Collections.IEnumerator ssi = subScorers.GetEnumerator();
float sumScore = 0.0f;
int nrMatches = 0;
while (ssi.MoveNext())
{
Explanation es = ((Scorer) ssi.Current).Explain(doc);
if (es.GetValue() > 0.0f)
{
// indicates match
sumScore += es.GetValue();
nrMatches++;
}
res.AddDetail(es);
}
if (nrMatchers >= minimumNrMatchers)
{
res.SetValue(sumScore);
res.SetDescription("sum over at least " + minimumNrMatchers + " of " + subScorers.Count + ":");
}
else
{
res.SetValue(0.0f);
res.SetDescription(nrMatches + " match(es) but at least " + minimumNrMatchers + " of " + subScorers.Count + " needed");
}
return res;
}
示例7: 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;
}
示例8: Explain
/// <summary>Returns an explanation of the score for a document.
/// <br>When this method is used, the {@link #next()} method
/// and the {@link #Score(HitCollector)} method should not be used.
/// </summary>
/// <param name="doc">The document number for the explanation.
/// </param>
public override Explanation Explain(int doc)
{
TermQuery query = (TermQuery) weight.GetQuery();
Explanation tfExplanation = new Explanation();
int tf = 0;
while (pointer < pointerMax)
{
if (docs[pointer] == doc)
tf = freqs[pointer];
pointer++;
}
if (tf == 0)
{
if (termDocs.SkipTo(doc))
{
if (termDocs.Doc() == doc)
{
tf = termDocs.Freq();
}
}
}
termDocs.Close();
tfExplanation.SetValue(GetSimilarity().Tf(tf));
tfExplanation.SetDescription("tf(termFreq(" + query.GetTerm() + ")=" + tf + ")");
return tfExplanation;
}
示例9: Explain
public override Explanation Explain(int doc)
{
Explanation res = new Explanation();
if (exclDisi.Advance(doc) == doc)
{
res.SetDescription("excluded");
}
else
{
res.SetDescription("not excluded");
res.AddDetail(reqScorer.Explain(doc));
}
return res;
}
示例10: Explain
/// <returns> An explanation for the score of a given document.
/// </returns>
public override Explanation Explain(int doc)
{
Explanation res = new Explanation();
float sumScore = 0.0f;
int nrMatches = 0;
foreach(Scorer s in subScorers)
{
Explanation es = s.Explain(doc);
if (es.GetValue() > 0.0f)
{
// indicates match
sumScore += es.GetValue();
nrMatches++;
}
res.AddDetail(es);
}
if (nrMatchers >= minimumNrMatchers)
{
res.SetValue(sumScore);
res.SetDescription("sum over at least " + minimumNrMatchers + " of " + subScorers.Count + ":");
}
else
{
res.SetValue(0.0f);
res.SetDescription(nrMatches + " match(es) but at least " + minimumNrMatchers + " of " + subScorers.Count + " needed");
}
return res;
}
示例11: Explain
public override Explanation Explain(int doc)
{
Explanation tfExplanation = new Explanation();
int d = Advance(doc);
float phraseFreq = (d == doc)?freq:0.0f;
tfExplanation.SetValue(GetSimilarity().Tf(phraseFreq));
tfExplanation.SetDescription("tf(phraseFreq=" + phraseFreq + ")");
return tfExplanation;
}
示例12: Explain
public virtual Explanation Explain(IndexReader reader, int doc)
{
Explanation sumExpl = new Explanation();
sumExpl.SetDescription("sum of:");
int coord = 0;
int maxCoord = 0;
float sum = 0.0f;
for (int i = 0; i < weights.Count; i++)
{
BooleanClause c = (BooleanClause) Enclosing_Instance.clauses[i];
Weight w = (Weight) weights[i];
Explanation e = w.Explain(reader, doc);
if (!c.IsProhibited())
maxCoord++;
if (e.GetValue() > 0)
{
if (!c.IsProhibited())
{
sumExpl.AddDetail(e);
sum += e.GetValue();
coord++;
}
else
{
return new Explanation(0.0f, "match prohibited");
}
}
else if (c.IsRequired())
{
return new Explanation(0.0f, "match required");
}
}
sumExpl.SetValue(sum);
if (coord == 1)
// only one clause matched
sumExpl = sumExpl.GetDetails()[0]; // eliminate wrapper
float coordFactor = similarity.Coord(coord, maxCoord);
if (coordFactor == 1.0f)
// coord is no-op
return sumExpl;
// eliminate wrapper
else
{
Explanation result = new Explanation();
result.SetDescription("product of:");
result.AddDetail(sumExpl);
result.AddDetail(new Explanation(coordFactor, "coord(" + coord + "/" + maxCoord + ")"));
result.SetValue(sum * coordFactor);
return result;
}
}
示例13: Explain
public override Explanation Explain(int doc)
{
ComplexExplanation result = new ComplexExplanation();
Explanation nonPayloadExpl = base.Explain(doc);
result.AddDetail(nonPayloadExpl);
//QUESTION: Is there a wau to avoid this skipTo call? We need to know whether to load the payload or not
Explanation payloadBoost = new Explanation();
result.AddDetail(payloadBoost);
/*
if (skipTo(doc) == true) {
processPayload();
}*/
float avgPayloadScore = (payloadsSeen > 0 ? (payloadScore / payloadsSeen) : 1);
payloadBoost.SetValue(avgPayloadScore);
//GSI: I suppose we could toString the payload, but I don't think that would be a good idea
payloadBoost.SetDescription("scorePayload(...)");
result.SetValue(nonPayloadExpl.GetValue() * avgPayloadScore);
result.SetDescription("btq, product of:");
result.SetMatch(nonPayloadExpl.GetValue() == 0 ? false : true); // LUCENE-1303
return result;
}
示例14: Explain
/// <summary>Gives and explanation for the score of a given document.</summary>
/// <todo> Show the resulting score. See BooleanScorer.explain() on how to do this. </todo>
public override Explanation Explain(int doc)
{
Explanation res = new Explanation();
res.SetDescription("At least " + minimumNrMatchers + " of");
System.Collections.IEnumerator ssi = subScorers.GetEnumerator();
while (ssi.MoveNext())
{
res.AddDetail(((Scorer) ssi.Current).Explain(doc));
}
return res;
}
示例15: Explain
/* Explain the score we computed for doc */
public virtual Explanation Explain(IndexReader reader, int doc)
{
if (Enclosing_Instance.disjuncts.Count == 1)
return ((Weight) weights[0]).Explain(reader, doc);
Explanation result = new Explanation();
float max = 0.0f, sum = 0.0f;
result.SetDescription(Enclosing_Instance.tieBreakerMultiplier == 0.0f ? "max of:" : "max plus " + Enclosing_Instance.tieBreakerMultiplier + " times others of:");
for (int i = 0; i < weights.Count; i++)
{
Explanation e = ((Weight) weights[i]).Explain(reader, doc);
if (e.GetValue() > 0)
{
result.AddDetail(e);
sum += e.GetValue();
max = System.Math.Max(max, e.GetValue());
}
}
result.SetValue(max + (sum - max) * Enclosing_Instance.tieBreakerMultiplier);
return result;
}