本文整理汇总了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);
}
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例5: AssertDocDeleted
private void AssertDocDeleted(SegmentReader reader, SegmentReader reader2, int doc)
{
Assert.AreEqual(reader.IsDeleted(doc), reader2.IsDeleted(doc));
}
示例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 };
}
}
}
}
}