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


C# Search.Explanation类代码示例

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

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

示例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;
 }
开发者ID:modulexcite,项目名称:BoboBrowse.Net,代码行数:7,代码来源:DefaultFacetTermScoringFunction.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: Explain

            public override Explanation Explain(IndexReader reader, int doc)
            {
                Explanation result = new Explanation();
                result.Value = _weight;
                result.Description = _parent.ToString();

                return result;
            }
开发者ID:modulexcite,项目名称:BoboBrowse.Net,代码行数:8,代码来源:SectionSearchQuery.cs

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

示例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;
 }
开发者ID:NightOwl888,项目名称:Bobo-Browse.Net,代码行数:10,代码来源:DefaultFacetTermScoringFunction.cs

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

示例9: ExplanationDialog

        public ExplanationDialog(Explanation e)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            treeExplain.BeginUpdate();
            AddNode(null, e);
            treeExplain.ExpandAll();
            treeExplain.EndUpdate();
        }
开发者ID:mammo,项目名称:LukeSharp,代码行数:12,代码来源:Explanation.cs

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

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

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

示例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");
			}
开发者ID:synhershko,项目名称:lucene.net,代码行数:14,代码来源:BBoxSimilarityValueSource.cs

示例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;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:18,代码来源:ExpressionRescorer.cs

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


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