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


C# SegmentReader.IsDeleted方法代码示例

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


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

示例1: CreateOpenBitSets

        static void CreateOpenBitSets(SegmentReader reader, IDictionary<string, HashSet<string>> feeds, IDictionary<string, IDictionary<string, OpenBitSet>> bitSetLookup)
        {
            for (int n = 0; n < reader.MaxDoc; n++)
            {
                if (reader.IsDeleted(n))
                {
                    continue;
                }

                Document document = reader.Document(n);

                string id = document.Get("Id");

                if (id == null)
                {
                    continue;
                }

                foreach (var feed in feeds)
                {
                    if (feed.Value.Contains(id))
                    {
                        bitSetLookup[feed.Key][reader.SegmentName].Set(n);
                    }
                }
            }
        }
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:27,代码来源:CuratedFeedFilter.cs

示例2: TestTermVectors

 /// <summary> Test term vectors for a segment.</summary>
 private Status.TermVectorStatus TestTermVectors(SegmentInfo info, SegmentReader reader, System.Globalization.NumberFormatInfo format)
 {
     var status = new Status.TermVectorStatus();
     
     try
     {
         if (infoStream != null)
         {
             infoStream.Write("    test: term vectors........");
         }
         
         for (int j = 0; j < info.docCount; ++j)
         {
             if (!reader.IsDeleted(j))
             {
                 status.docCount++;
                 ITermFreqVector[] tfv = reader.GetTermFreqVectors(j);
                 if (tfv != null)
                 {
                     status.totVectors += tfv.Length;
                 }
             }
         }
         
         Msg(System.String.Format(format, "OK [{0:d} total vector count; avg {1:f} term/freq vector fields per doc]", new object[] { status.totVectors, (((float) status.totVectors) / status.docCount) }));
     }
     catch (System.Exception e)
     {
         Msg("ERROR [" + System.Convert.ToString(e.Message) + "]");
         status.error = e;
         if (infoStream != null)
         {
             infoStream.WriteLine(e.StackTrace);
         }
     }
     
     return status;
 }
开发者ID:Nangal,项目名称:lucene.net,代码行数:39,代码来源:CheckIndex.cs

示例3: TestStoredFields

 /// <summary> Test stored fields for a segment.</summary>
 private Status.StoredFieldStatus TestStoredFields(SegmentInfo info, SegmentReader reader, System.Globalization.NumberFormatInfo format)
 {
     var status = new Status.StoredFieldStatus();
     
     try
     {
         if (infoStream != null)
         {
             infoStream.Write("    test: stored fields.......");
         }
         
         // Scan stored fields for all documents
         for (int j = 0; j < info.docCount; ++j)
         {
             if (!reader.IsDeleted(j))
             {
                 status.docCount++;
                 Document doc = reader.Document(j);
                 status.totFields += doc.GetFields().Count;
             }
         }
         
         // Validate docCount
         if (status.docCount != reader.NumDocs())
         {
             throw new System.SystemException("docCount=" + status.docCount + " but saw " + status.docCount + " undeleted docs");
         }
         
         Msg(string.Format(format, "OK [{0:d} total field count; avg {1:f} fields per doc]", new object[] { status.totFields, (((float) status.totFields) / status.docCount) }));
     }
     catch (System.Exception e)
     {
         Msg("ERROR [" + System.Convert.ToString(e.Message) + "]");
         status.error = e;
         if (infoStream != null)
         {
             infoStream.WriteLine(e.StackTrace);
         }
     }
     
     return status;
 }
开发者ID:Nangal,项目名称:lucene.net,代码行数:43,代码来源:CheckIndex.cs

示例4: TestDelete

		public virtual void  TestDelete()
		{
			Document docToDelete = new Document();
			DocHelper.SetupDoc(docToDelete);
			DocHelper.WriteDoc(dir, "seg-to-delete", docToDelete);
			try
			{
				SegmentReader deleteReader = new SegmentReader(new SegmentInfo("seg-to-delete", 1, dir));
				Assert.IsTrue(deleteReader != null);
				Assert.IsTrue(deleteReader.NumDocs() == 1);
				deleteReader.Delete(0);
				Assert.IsTrue(deleteReader.IsDeleted(0) == true);
				Assert.IsTrue(deleteReader.HasDeletions() == true);
				Assert.IsTrue(deleteReader.NumDocs() == 0);
				try
				{
					Document test = deleteReader.Document(0);
					Assert.IsTrue(false);
				}
				catch (System.ArgumentException e)
				{
					Assert.IsTrue(true);
				}
			}
			catch (System.IO.IOException e)
			{
				System.Console.Error.WriteLine(e.StackTrace);
				Assert.IsTrue(false);
			}
		}
开发者ID:runefs,项目名称:Marvin,代码行数:30,代码来源:TestSegmentReader.cs

示例5: AssertDocDeleted

		private void  AssertDocDeleted(SegmentReader reader, SegmentReader reader2, int doc)
		{
			Assert.AreEqual(reader.IsDeleted(doc), reader2.IsDeleted(doc));
		}
开发者ID:synhershko,项目名称:lucene.net,代码行数:4,代码来源:TestIndexReaderClone.cs

示例6: UpdateMatchingDocs

        static void UpdateMatchingDocs(IDictionary<string, MatchingDocsEntry> matchingDocsLookup, SegmentReader reader, IDictionary<string, ISet<string>> frameworkCompatibility)
        {
            for (int doc = 0; doc < reader.MaxDoc; doc++)
            {
                if (reader.IsDeleted(doc))
                {
                    continue;
                }

                Document document = reader.Document(doc);

                string id = PackageVersions.GetId(document);

                if (id == null)
                {
                    continue;
                }

                NuGetVersion version = PackageVersions.GetVersion(document);

                if (version == null)
                {
                    continue;
                }

                Field[] frameworks = document.GetFields("TargetFramework");

                foreach (KeyValuePair<string, ISet<string>> frameworkKV in frameworkCompatibility)
                {
                    bool isCompatible = false;

                    if (frameworkKV.Key == "any")
                    {
                        isCompatible = true;
                    }
                    else
                    {
                        foreach (Field frameworkField in frameworks)
                        {
                            string framework = frameworkField.StringValue;
                            if (framework == "any" || framework == "agnostic" || frameworkKV.Value.Contains(framework))
                            {
                                isCompatible = true;
                            }
                        }
                    }

                    MatchingDocsEntry entry = matchingDocsLookup[frameworkKV.Key];

                    if (isCompatible)
                    {
                        if (!version.IsPrerelease)
                        {
                            if (!entry.MatchingDocs.ContainsKey(id) || entry.MatchingDocs[id].Version < version)
                            {
                                entry.MatchingDocs[id] = new MatchingDoc { Version = version, SegmentName = reader.SegmentName, Doc = doc };
                            }
                        }

                        if (!entry.MatchingDocsPre.ContainsKey(id) || entry.MatchingDocsPre[id].Version < version)
                        {
                            entry.MatchingDocsPre[id] = new MatchingDoc { Version = version, SegmentName = reader.SegmentName, Doc = doc };
                        }
                    }
                }
            }
        }
开发者ID:jinujoseph,项目名称:NuGet.Services.Metadata,代码行数:67,代码来源:Compatibility.cs


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