当前位置: 首页>>代码示例>>C#>>正文


C# Explanation.SetDescription方法代码示例

本文整理汇总了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;
 }
开发者ID:vineelkovvuri,项目名称:ExtendableDesktopSearch,代码行数:14,代码来源:ReqExclScorer.cs

示例2: Explain

			public override Explanation Explain(int doc)
			{
				Explanation explanation = new Explanation();
				explanation.SetValue(1.0f);
				explanation.SetDescription("MatchAllDocsQuery");
				return explanation;
			}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:7,代码来源:MatchAllDocsQuery.cs

示例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;
 }
开发者ID:vineelkovvuri,项目名称:ExtendableDesktopSearch,代码行数:12,代码来源:ReqOptSumScorer.cs

示例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;
        }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:54,代码来源:SpanWeight.cs

示例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;
            }
开发者ID:vineelkovvuri,项目名称:ExtendableDesktopSearch,代码行数:21,代码来源:ConstantScoreQuery.cs

示例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;
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:31,代码来源:DisjunctionSumScorer.cs

示例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;
		}
开发者ID:zweib730,项目名称:beagrep,代码行数:14,代码来源:PhraseScorer.cs

示例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;
        }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:33,代码来源:TermScorer.cs

示例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;
		}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:14,代码来源:ReqExclScorer.cs

示例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;
		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:30,代码来源:DisjunctionSumScorer.cs

示例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;
		}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:11,代码来源:PhraseScorer.cs

示例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;
                }
            }
开发者ID:karino2,项目名称:wikipediaconv,代码行数:53,代码来源:BooleanQuery.cs

示例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;
                }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:23,代码来源:BoostingTermQuery.cs

示例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;
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:13,代码来源:DisjunctionSumScorer.cs

示例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;
			}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:21,代码来源:DisjunctionMaxQuery.cs


注:本文中的Lucene.Net.Search.Explanation.SetDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。