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


C# Search.ScoreDoc类代码示例

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


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

示例1: constructor_should_convert_document_and_scoredoc_to_properties_and_parse_createdon_date

		public void constructor_should_convert_document_and_scoredoc_to_properties_and_parse_createdon_date()
		{
			// Arrange
			LuceneDocument document = new LuceneDocument();
			document.Add(CreateField("id","123"));
			document.Add(CreateField("title", "the title"));
			document.Add(CreateField("contentsummary", "the summary"));
			document.Add(CreateField("tags", "tag1 tag2"));
			document.Add(CreateField("createdby", "gandhi"));
			document.Add(CreateField("contentlength", "999"));
			document.Add(CreateField("createdon", DateTime.Today.ToString()));

			ScoreDoc scoreDoc = new ScoreDoc(0, 9.50f);

			// Act
			SearchResultViewModel model = new SearchResultViewModel(document, scoreDoc);

			// Assert
			Assert.That(model.Id, Is.EqualTo(123));
			Assert.That(model.Title, Is.EqualTo("the title"));
			Assert.That(model.ContentSummary, Is.EqualTo("the summary"));
			Assert.That(model.Tags, Is.EqualTo("tag1 tag2"));
			Assert.That(model.CreatedBy, Is.EqualTo("gandhi"));
			Assert.That(model.ContentLength, Is.EqualTo(999));
			Assert.That(model.CreatedOn, Is.EqualTo(DateTime.Today)); // only the date should be parsed
			Assert.That(model.Score, Is.EqualTo(9.50f));
		}
开发者ID:RyanGroom,项目名称:roadkill,代码行数:27,代码来源:SearchResultViewModelTests.cs

示例2: TopScoreDocCollector

 // prevents instantiation
 private TopScoreDocCollector(int numHits)
     : base(new HitQueue(numHits, true))
 {
     // HitQueue implements getSentinelObject to return a ScoreDoc, so we know
     // that at this point top() is already initialized.
     pqTop = (ScoreDoc) pq.Top();
 }
开发者ID:o0111,项目名称:ruralcafe,代码行数:8,代码来源:TopScoreDocCollector.cs

示例3: Add

 /// <summary>
 /// Adds an Object to a PriorityQueue in log(size) time. If one tries to add
 /// more objects than maxSize from initialize an
 /// {@link ArrayIndexOutOfBoundsException} is thrown.
 /// </summary>
 /// <param name="element"></param>
 /// <returns>the new 'bottom' element in the queue.</returns>
 public ScoreDoc Add(ScoreDoc element)
 {
     size++;
     heap[size] = element;
     UpHeap(size);
     return heap[1];
 }
开发者ID:modulexcite,项目名称:BoboBrowse.Net,代码行数:14,代码来源:DocIDPriorityQueue.cs

示例4: PopulateResults

		/// <summary> Populates the results array with the ScoreDoc instaces. This can be
		/// overridden in case a different ScoreDoc type should be returned.
		/// </summary>
		protected internal virtual void  PopulateResults(ScoreDoc[] results, int howMany)
		{
			for (int i = howMany - 1; i >= 0; i--)
			{
				results[i] = (ScoreDoc) pq.Pop();
			}
		}
开发者ID:Rationalle,项目名称:ravendb,代码行数:10,代码来源:TopDocsCollector.cs

示例5: ConvertToDataTable

        private static DataTable ConvertToDataTable(IndexSearcher indexSearcher, ScoreDoc[] result)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn(LuceneConfig.Field_Path));
            dt.Columns.Add(new DataColumn(LuceneConfig.Field_FileName));
            dt.Columns.Add(new DataColumn(LuceneConfig.Field_PageNumber));
            dt.Columns.Add(new DataColumn(LuceneConfig.Field_ContentByPage));
            dt.Columns.Add(new DataColumn(LuceneConfig.Field_Score));

            foreach (ScoreDoc scoreDoc in result)
            {
                Document doc = indexSearcher.Doc(scoreDoc.Doc);
                DataRow dr = dt.NewRow();

                dr[LuceneConfig.Field_Path] = doc.Get(LuceneConfig.Field_Path);
                dr[LuceneConfig.Field_FileName] = doc.Get(LuceneConfig.Field_FileName);
                dr[LuceneConfig.Field_PageNumber] = doc.Get(LuceneConfig.Field_PageNumber);
                dr[LuceneConfig.Field_ContentByPage] = doc.Get(LuceneConfig.Field_ContentByPage);
                dr[LuceneConfig.Field_Score] = scoreDoc.Score;

                dt.Rows.Add(dr);
            }

            return dt;
        }
开发者ID:NDChen,项目名称:MyDemoCode,代码行数:25,代码来源:SearchHelper.cs

示例6: CheckDocIds

 /// <summary>
 /// Tests that a Hits has an expected order of documents </summary>
 public static void CheckDocIds(string mes, int[] results, ScoreDoc[] hits)
 {
     Assert.AreEqual(hits.Length, results.Length, mes + " nr of hits");
     for (int i = 0; i < results.Length; i++)
     {
         Assert.AreEqual(results[i], hits[i].Doc, mes + " doc nrs for hit " + i);
     }
 }
开发者ID:WakeflyCBass,项目名称:lucenenet,代码行数:10,代码来源:CheckHits.cs

示例7: Compare

		public virtual int Compare(ScoreDoc i, ScoreDoc j)
		{
			if (i.score > j.score)
				return - 1;
			if (i.score < j.score)
				return 1;
			return 0;
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:8,代码来源:ScoreDocComparator.cs

示例8: CompareRanks

 protected void CompareRanks(ScoreDoc[] hits, int[] ranks)
 {
     Assert.AreEqual(ranks.Length, hits.Length);
     for (int i = 0; i < ranks.Length; i++)
     {
         Assert.AreEqual(ranks[i], hits[i].Doc);
     }
 }
开发者ID:Nangal,项目名称:lucene.net,代码行数:8,代码来源:ShingleAnalyzerWrapperTest.cs

示例9: Should_Throw_ArgumentNullException_When_Document_Is_Null

		public void Should_Throw_ArgumentNullException_When_Document_Is_Null()
		{
			// Arrange
			LuceneDocument document = null;
			ScoreDoc scoreDoc = new ScoreDoc(0, 9.50f);

			// Act + Assert
			SearchResultViewModel model = new SearchResultViewModel(document, scoreDoc);
		}
开发者ID:RyanGroom,项目名称:roadkill,代码行数:9,代码来源:SearchResultViewModelTests.cs

示例10: Compare

 public override int Compare(ScoreDoc doc1, ScoreDoc doc2)
 {
     for (int i = 0; i < _comparators.Length; ++i)
     {
         int v = _comparators[i].Compare(doc1, doc2);
         if (v != 0) return v;
     }
     return 0;
 }
开发者ID:modulexcite,项目名称:BoboBrowse.Net,代码行数:9,代码来源:MultiDocIdComparator.cs

示例11: PreviousSearchState

 public PreviousSearchState(Query query, Sort sort, ScoreDoc searchAfterLocal, ScoreDoc searchAfterShard, long[] versions, int numHitsPaged)
 {
     this.Versions = (long[])versions.Clone();
     this.SearchAfterLocal = searchAfterLocal;
     this.SearchAfterShard = searchAfterShard;
     this.Sort = sort;
     this.Query = query;
     this.NumHitsPaged = numHitsPaged;
     SearchTimeNanos = TimeHelper.NanoTime();
 }
开发者ID:joyanta,项目名称:lucene.net,代码行数:10,代码来源:TestShardSearching.cs

示例12: Compare

			public int Compare(ScoreDoc i, ScoreDoc j)
			{
				int fi = fieldOrder[i.doc];
				int fj = fieldOrder[j.doc];
				if (fi < fj)
					return - 1;
				if (fi > fj)
					return 1;
				return 0;
			}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:10,代码来源:FieldSortedHitQueue.cs

示例13: TopDocs

        // javadoc inherited
        public override TopDocs TopDocs()
        {
            FieldSortedHitQueue fshq = (FieldSortedHitQueue) hq;
            ScoreDoc[] scoreDocs = new ScoreDoc[fshq.Size()];
            for (int i = fshq.Size() - 1; i >= 0; i--)
                // put docs in array
                scoreDocs[i] = fshq.FillFields((FieldDoc) fshq.Pop());
			
            return new TopFieldDocs(totalHits, scoreDocs, fshq.GetFields(), fshq.GetMaxScore());
        }
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:11,代码来源:TopFieldDocCollector.cs

示例14: TopDocs

		/// <summary>The top-scoring hits. </summary>
		public virtual TopDocs TopDocs()
		{
			ScoreDoc[] scoreDocs = new ScoreDoc[hq.Size()];
			for (int i = hq.Size() - 1; i >= 0; i--)
				// put docs in array
				scoreDocs[i] = (ScoreDoc) hq.Pop();
			
			float maxScore = (totalHits == 0) ? System.Single.NegativeInfinity : scoreDocs[0].score;
			
			return new TopDocs(totalHits, scoreDocs, maxScore);
		}
开发者ID:zweib730,项目名称:beagrep,代码行数:12,代码来源:TopDocCollector.cs

示例15: AllHitsCollector

        public AllHitsCollector(ScoreDoc[] docs)
        {
            this.outOfOrder = true;
            this.shouldScore = true;
            hits = new List<AllHit>(docs.Length);

            foreach (var doc in docs)
            {
                this.hits.Add(new AllHit(doc.doc, doc.score));
            }
        }
开发者ID:rhayesbite,项目名称:Examine,代码行数:11,代码来源:AllHitsCollector.cs


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