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


C# Explanation.AddDetail方法代码示例

本文整理汇总了C#中Lucene.Net.Search.Explanation.AddDetail方法的典型用法代码示例。如果您正苦于以下问题:C# Explanation.AddDetail方法的具体用法?C# Explanation.AddDetail怎么用?C# Explanation.AddDetail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lucene.Net.Search.Explanation的用法示例。


在下文中一共展示了Explanation.AddDetail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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;
        }
开发者ID:yao-yi,项目名称:BoboBrowse.Net,代码行数:31,代码来源:FacetBasedBoostScorerBuilder.cs

示例2: 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

示例3: 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

示例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));
     }
 }
开发者ID:yao-yi,项目名称:BoboBrowse.Net,代码行数:32,代码来源:RecencyBoostScorerBuilder.cs

示例5: 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;
 }
开发者ID:raol,项目名称:lucene.net,代码行数:20,代码来源:DistanceSimilarity.cs

示例6: 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

示例7: Explain

			public override Explanation Explain(IndexReader reader, int doc)
			{
				
				Explanation result = new Explanation();
				result.Description = "weight(" + Query + " in " + doc + "), product of:";
				
				System.Text.StringBuilder docFreqs = new System.Text.StringBuilder();
				System.Text.StringBuilder query = new System.Text.StringBuilder();
				query.Append('\"');
				docFreqs.Append(idfExp.Explain());
				for (int i = 0; i < Enclosing_Instance.terms.Count; i++)
				{
					if (i != 0)
					{
						query.Append(" ");
					}
					
					Term term = Enclosing_Instance.terms[i];
					
					query.Append(term.Text);
				}
				query.Append('\"');
				
				Explanation idfExpl = new Explanation(idf, "idf(" + Enclosing_Instance.field + ":" + docFreqs + ")");
				
				// explain query weight
				Explanation queryExpl = new Explanation();
				queryExpl.Description = "queryWeight(" + Query + "), product of:";
				
				Explanation boostExpl = new Explanation(Enclosing_Instance.Boost, "boost");
				if (Enclosing_Instance.Boost != 1.0f)
					queryExpl.AddDetail(boostExpl);
				queryExpl.AddDetail(idfExpl);
				
				Explanation queryNormExpl = new Explanation(queryNorm, "queryNorm");
				queryExpl.AddDetail(queryNormExpl);
				
				queryExpl.Value = boostExpl.Value * idfExpl.Value * queryNormExpl.Value;
				
				result.AddDetail(queryExpl);
				
				// explain field weight
				Explanation fieldExpl = new Explanation();
				fieldExpl.Description = "fieldWeight(" + Enclosing_Instance.field + ":" + query + " in " + doc + "), product of:";
				
				PhraseScorer scorer = (PhraseScorer)Scorer(reader, true, false);
				if (scorer == null)
				{
					return new Explanation(0.0f, "no matching docs");
				}
                Explanation tfExplanation = new Explanation();
                int d = scorer.Advance(doc);
                float phraseFreq = (d == doc) ? scorer.CurrentFreq() : 0.0f;
                tfExplanation.Value = similarity.Tf(phraseFreq);
                tfExplanation.Description = "tf(phraseFreq=" + phraseFreq + ")";

                fieldExpl.AddDetail(tfExplanation);
				fieldExpl.AddDetail(idfExpl);
				
				Explanation fieldNormExpl = new Explanation();
				byte[] fieldNorms = reader.Norms(Enclosing_Instance.field);
				float fieldNorm = fieldNorms != null?Similarity.DecodeNorm(fieldNorms[doc]):1.0f;
				fieldNormExpl.Value = fieldNorm;
				fieldNormExpl.Description = "fieldNorm(field=" + Enclosing_Instance.field + ", doc=" + doc + ")";
				fieldExpl.AddDetail(fieldNormExpl);

                fieldExpl.Value = tfExplanation.Value * idfExpl.Value * fieldNormExpl.Value;
				
				result.AddDetail(fieldExpl);
				
				// combine them
				result.Value = queryExpl.Value * fieldExpl.Value;
				
				if (queryExpl.Value == 1.0f)
					return fieldExpl;
				
				return result;
			}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:78,代码来源:PhraseQuery.cs

示例8: Explain

 public override Explanation Explain(IndexReader ir, int i)
 {
     Explanation inner = weight.Explain(ir, i);
     if (Enclosing_Instance.GetBoost() != 1)
     {
         Explanation preBoost = inner;
         inner = new Explanation(inner.GetValue() * Enclosing_Instance.GetBoost(), "product of:");
         inner.AddDetail(new Explanation(Enclosing_Instance.GetBoost(), "boost"));
         inner.AddDetail(preBoost);
     }
     Filter f = Enclosing_Instance.filter;
     DocIdSet docIdSet = f.GetDocIdSet(ir);
     DocIdSetIterator docIdSetIterator = docIdSet == null?DocIdSet.EMPTY_DOCIDSET.Iterator():docIdSet.Iterator();
     if (docIdSetIterator == null)
     {
         docIdSetIterator = DocIdSet.EMPTY_DOCIDSET.Iterator();
     }
     if (docIdSetIterator.Advance(i) == i)
     {
         return inner;
     }
     else
     {
         Explanation result = new Explanation(0.0f, "failure to match filter: " + f.ToString());
         result.AddDetail(inner);
         return result;
     }
 }
开发者ID:sinsay,项目名称:SSE,代码行数:28,代码来源:FilteredQuery.cs

示例9: Explain

 public override Explanation Explain(int doc, Explanation freq)
 {
     Explanation boostExplanation = new Explanation(Values.Get(doc), "indexDocValue(" + OuterInstance.BoostField + ")");
     Explanation simExplanation = Sub.Explain(doc, freq);
     Explanation expl = new Explanation(boostExplanation.Value * simExplanation.Value, "product of:");
     expl.AddDetail(boostExplanation);
     expl.AddDetail(simExplanation);
     return expl;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:9,代码来源:TestDocValuesScoring.cs

示例10: Explain

			public override Explanation Explain(IndexReader reader, int doc)
			{
				
				ComplexExplanation result = new ComplexExplanation();
				result.Description = "weight(" + Query + " in " + doc + "), product of:";
				
				Explanation expl = new Explanation(idf, idfExp.Explain());
				
				// explain query weight
				Explanation queryExpl = new Explanation();
				queryExpl.Description = "queryWeight(" + Query + "), product of:";
				
				Explanation boostExpl = new Explanation(Enclosing_Instance.Boost, "boost");
				if (Enclosing_Instance.Boost != 1.0f)
					queryExpl.AddDetail(boostExpl);
				queryExpl.AddDetail(expl);
				
				Explanation queryNormExpl = new Explanation(queryNorm, "queryNorm");
				queryExpl.AddDetail(queryNormExpl);
				
				queryExpl.Value = boostExpl.Value * expl.Value * queryNormExpl.Value;
				
				result.AddDetail(queryExpl);
				
				// explain field weight
				System.String field = Enclosing_Instance.term.Field;
				ComplexExplanation fieldExpl = new ComplexExplanation();
				fieldExpl.Description = "fieldWeight(" + Enclosing_Instance.term + " in " + doc + "), product of:";

                Explanation tfExplanation = new Explanation();
                int tf = 0;
                TermDocs termDocs = reader.TermDocs(enclosingInstance.term);
                if (termDocs != null)
                {
                    try
                    {
                        if (termDocs.SkipTo(doc) && termDocs.Doc == doc)
                        {
                            tf = termDocs.Freq;
                        }
                    }
                    finally
                    {
                        termDocs.Close();
                    }
                    tfExplanation.Value = similarity.Tf(tf);
                    tfExplanation.Description = "tf(termFreq(" + enclosingInstance.term + ")=" + tf + ")";
                }
                else
                {
                    tfExplanation.Value = 0.0f;
                    tfExplanation.Description = "no matching term";
                }
                fieldExpl.AddDetail(tfExplanation);
				fieldExpl.AddDetail(expl);
				
				Explanation fieldNormExpl = new Explanation();
				byte[] fieldNorms = reader.Norms(field);
				float fieldNorm = fieldNorms != null?Similarity.DecodeNorm(fieldNorms[doc]):1.0f;
				fieldNormExpl.Value = fieldNorm;
				fieldNormExpl.Description = "fieldNorm(field=" + field + ", doc=" + doc + ")";
				fieldExpl.AddDetail(fieldNormExpl);

                fieldExpl.Match = tfExplanation.IsMatch;
                fieldExpl.Value = tfExplanation.Value * expl.Value * fieldNormExpl.Value;
				
				result.AddDetail(fieldExpl);
				System.Boolean? tempAux = fieldExpl.Match;
				result.Match = tempAux;
				
				// combine them
				result.Value = queryExpl.Value * fieldExpl.Value;
				
				if (queryExpl.Value == 1.0f)
					return fieldExpl;
				
				return result;
			}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:78,代码来源:TermQuery.cs

示例11: Explain

			public virtual Explanation Explain(IndexReader reader, int doc)
			{
				
				Explanation result = new Explanation();
				result.SetDescription("weight(" + GetQuery() + " in " + doc + "), product of:");
				
				System.Text.StringBuilder docFreqs = new System.Text.StringBuilder();
				System.Text.StringBuilder query = new System.Text.StringBuilder();
				query.Append('\"');
				for (int i = 0; i < Enclosing_Instance.terms.Count; i++)
				{
					if (i != 0)
					{
						docFreqs.Append(" ");
						query.Append(" ");
					}
					
					Term term = (Term) Enclosing_Instance.terms[i];
					
					docFreqs.Append(term.Text());
					docFreqs.Append("=");
					docFreqs.Append(reader.DocFreq(term));
					
					query.Append(term.Text());
				}
				query.Append('\"');
				
				Explanation idfExpl = new Explanation(idf, "idf(" + Enclosing_Instance.field + ": " + docFreqs + ")");
				
				// explain query weight
				Explanation queryExpl = new Explanation();
				queryExpl.SetDescription("queryWeight(" + GetQuery() + "), product of:");
				
				Explanation boostExpl = new Explanation(Enclosing_Instance.GetBoost(), "boost");
				if (Enclosing_Instance.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
				Explanation fieldExpl = new Explanation();
				fieldExpl.SetDescription("fieldWeight(" + Enclosing_Instance.field + ":" + query + " in " + doc + "), product of:");
				
				Explanation tfExpl = Scorer(reader).Explain(doc);
				fieldExpl.AddDetail(tfExpl);
				fieldExpl.AddDetail(idfExpl);
				
				Explanation fieldNormExpl = new Explanation();
				byte[] fieldNorms = reader.Norms(Enclosing_Instance.field);
				float fieldNorm = fieldNorms != null ? Similarity.DecodeNorm(fieldNorms[doc]) : 0.0f;
				fieldNormExpl.SetValue(fieldNorm);
				fieldNormExpl.SetDescription("fieldNorm(field=" + Enclosing_Instance.field + ", doc=" + doc + ")");
				fieldExpl.AddDetail(fieldNormExpl);
				
				fieldExpl.SetValue(tfExpl.GetValue() * idfExpl.GetValue() * fieldNormExpl.GetValue());
				
				result.AddDetail(fieldExpl);
				
				// combine them
				result.SetValue(queryExpl.GetValue() * fieldExpl.GetValue());
				
				if (queryExpl.GetValue() == 1.0f)
					return fieldExpl;
				
				return result;
			}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:72,代码来源:PhraseQuery.cs

示例12: CustomExplain

 public override Explanation CustomExplain(int doc, Explanation subQueryExpl, Explanation valSrcExpl)
 {
     float valSrcScore = valSrcExpl == null ? 0 : valSrcExpl.Value;
     Explanation exp = new Explanation(valSrcScore + subQueryExpl.Value, "custom score: sum of:");
     exp.AddDetail(subQueryExpl);
     if (valSrcExpl != null)
     {
         exp.AddDetail(valSrcExpl);
     }
     return exp;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:11,代码来源:TestCustomScoreQuery.cs

示例13: Score


//.........这里部分代码省略.........
					double qryWestRight = Math.Min(target.GetMaxX(), 180.0);
					double qryWestWidth = qryWestRight - qryWestLeft;
					if (qryWestWidth > 0)
					{
						width = qryWestWidth;
					}
					else
					{
						double qryEastLeft = Math.Max(target.GetMaxX(), -180.0);
						double qryEastRight = Math.Min(queryExtent.GetMaxX(), target.GetMaxX());
						double qryEastWidth = qryEastRight - qryEastLeft;
						if (qryEastWidth > 0)
						{
							width = qryEastWidth;
						}
					}
				}
			}
			else
			{ // queries that do not cross the date line

				if (target.GetCrossesDateLine())
				{
					double tgtWestLeft = Math.Max(queryExtent.GetMinX(), target.GetMinX());
					double tgtWestRight = Math.Min(queryExtent.GetMaxX(), 180.0);
					double tgtWestWidth = tgtWestRight - tgtWestLeft;
					if (tgtWestWidth > 0)
					{
						width = tgtWestWidth;
					}
					else
					{
						double tgtEastLeft = Math.Max(queryExtent.GetMinX(), -180.0);
						double tgtEastRight = Math.Min(queryExtent.GetMaxX(), target.GetMaxX());
						double tgtEastWidth = tgtEastRight - tgtEastLeft;
						if (tgtEastWidth > 0)
						{
							width = tgtEastWidth;
						}
					}
				}
				else
				{
					double left = Math.Max(queryExtent.GetMinX(), target.GetMinX());
					double right = Math.Min(queryExtent.GetMaxX(), target.GetMaxX());
					width = right - left;
				}
			}


			// calculate the score
			if ((width > 0) && (height > 0))
			{
				double intersectionArea = width * height;
				double queryRatio = intersectionArea / queryArea;
				double targetRatio = intersectionArea / targetArea;
				double queryFactor = Math.Pow(queryRatio, queryPower);
				double targetFactor = Math.Pow(targetRatio, targetPower);
				score = queryFactor * targetFactor * 10000.0;

				if (exp != null)
				{
					//        StringBuilder sb = new StringBuilder();
					//        sb.append("\nscore=").append(score);
					//        sb.append("\n  query=").append();
					//        sb.append("\n  target=").append(target.toString());
					//        sb.append("\n  intersectionArea=").append(intersectionArea);
					//        
					//        sb.append(" queryArea=").append(queryArea).append(" targetArea=").append(targetArea);
					//        sb.append("\n  queryRatio=").append(queryRatio).append(" targetRatio=").append(targetRatio);
					//        sb.append("\n  queryFactor=").append(queryFactor).append(" targetFactor=").append(targetFactor);
					//        sb.append(" (queryPower=").append(queryPower).append(" targetPower=").append(targetPower).append(")");

					exp.Value = (float) score;
					exp.Description = GetType().Name;

					Explanation e = null;

					exp.AddDetail(e = new Explanation((float)intersectionArea, "IntersectionArea"));
					e.AddDetail(new Explanation((float)width, "width; Query: " + queryExtent));
					e.AddDetail(new Explanation((float)height, "height; Target: " + target));

					exp.AddDetail(e = new Explanation((float)queryFactor, "Query"));
					e.AddDetail(new Explanation((float)queryArea, "area"));
					e.AddDetail(new Explanation((float)queryRatio, "ratio"));
					e.AddDetail(new Explanation((float)queryPower, "power"));

					exp.AddDetail(e = new Explanation((float)targetFactor, "Target"));
					e.AddDetail(new Explanation((float)targetArea, "area"));
					e.AddDetail(new Explanation((float)targetRatio, "ratio"));
					e.AddDetail(new Explanation((float)targetPower, "power"));
				}
			}
			else if (exp != null)
			{
				exp.Value = 0;
				exp.Description = "Shape does not intersect";
			}
			return score;
		}
开发者ID:raol,项目名称:lucene.net,代码行数:101,代码来源:AreaSimilarity.cs

示例14: Explain

			public virtual Explanation Explain(IndexReader reader, int doc)
			{
				
				ComplexExplanation result = new ComplexExplanation();
				result.SetDescription("weight(" + GetQuery() + " in " + doc + "), product of:");
				
				Explanation idfExpl = new Explanation(idf, "idf(docFreq=" + reader.DocFreq(Enclosing_Instance.term) + ", numDocs=" + reader.NumDocs() + ")");
				
				// explain query weight
				Explanation queryExpl = new Explanation();
				queryExpl.SetDescription("queryWeight(" + GetQuery() + "), product of:");
				
				Explanation boostExpl = new Explanation(Enclosing_Instance.GetBoost(), "boost");
				if (Enclosing_Instance.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
				System.String field = Enclosing_Instance.term.Field();
				ComplexExplanation fieldExpl = new ComplexExplanation();
				fieldExpl.SetDescription("fieldWeight(" + Enclosing_Instance.term + " in " + doc + "), product of:");
				
				Explanation tfExpl = Scorer(reader).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]) : 0.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:vikasraz,项目名称:indexsearchutils,代码行数:55,代码来源:TermQuery.cs

示例15: 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


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