本文整理汇总了C#中Lucene.Net.Index.SegmentReader类的典型用法代码示例。如果您正苦于以下问题:C# SegmentReader类的具体用法?C# SegmentReader怎么用?C# SegmentReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SegmentReader类属于Lucene.Net.Index命名空间,在下文中一共展示了SegmentReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetUp
public override void SetUp()
{
base.SetUp();
DocHelper.SetupDoc(testDoc);
SegmentInfo info = DocHelper.WriteDoc(dir, testDoc);
reader = SegmentReader.Get(info);
}
开发者ID:Rationalle,项目名称:ravendb,代码行数:7,代码来源:TestSegmentReader.cs
示例2: TestBadSeek
public virtual void TestBadSeek()
{
try
{
//After adding the document, we should be able to read it back in
SegmentReader reader = new SegmentReader(new SegmentInfo("test", 3, dir));
Assert.IsTrue(reader != null);
SegmentTermDocs segTermDocs = new SegmentTermDocs(reader);
Assert.IsTrue(segTermDocs != null);
segTermDocs.Seek(new Term("textField2", "bad"));
Assert.IsTrue(segTermDocs.Next() == false);
reader.Close();
}
catch (System.IO.IOException e)
{
Assert.IsTrue(false);
}
try
{
//After adding the document, we should be able to read it back in
SegmentReader reader = new SegmentReader(new SegmentInfo("test", 3, dir));
Assert.IsTrue(reader != null);
SegmentTermDocs segTermDocs = new SegmentTermDocs(reader);
Assert.IsTrue(segTermDocs != null);
segTermDocs.Seek(new Term("junk", "bad"));
Assert.IsTrue(segTermDocs.Next() == false);
reader.Close();
}
catch (System.IO.IOException e)
{
Assert.IsTrue(false);
}
}
开发者ID:runefs,项目名称:Marvin,代码行数:33,代码来源:TestSegmentTermDocs.cs
示例3: DoBody
protected internal override object DoBody(string segmentFileName)
{
var sis = new SegmentInfos();
sis.Read(directory, segmentFileName);
var readers = new SegmentReader[sis.Size()];
for (int i = sis.Size() - 1; i >= 0; i--)
{
System.IO.IOException prior = null;
bool success = false;
try
{
readers[i] = new SegmentReader(sis.Info(i), termInfosIndexDivisor, IOContext.READ);
success = true;
}
catch (System.IO.IOException ex)
{
prior = ex;
}
finally
{
if (!success)
{
IOUtils.CloseWhileHandlingException(prior, readers);
}
}
}
return new StandardDirectoryReader(directory, readers, null, sis, termInfosIndexDivisor, false);
}
开发者ID:ChristopherHaws,项目名称:lucenenet,代码行数:28,代码来源:StandardDirectoryReader.cs
示例4: Norm
public Norm(SegmentReader enclosingInstance, IndexInput in_Renamed, int number, long normSeek)
{
InitBlock(enclosingInstance);
this.in_Renamed = in_Renamed;
this.number = number;
this.normSeek = normSeek;
}
开发者ID:zweib730,项目名称:beagrep,代码行数:7,代码来源:SegmentReader.cs
示例5: 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
示例6: AllTermDocs
protected internal AllTermDocs(SegmentReader parent) : base(parent.MaxDoc)
{
lock (parent)
{
this.deletedDocs = parent.deletedDocs;
}
}
开发者ID:modulexcite,项目名称:Xamarin-Lucene.Net,代码行数:7,代码来源:AllTermDocs.cs
示例7: SegmentTermDocs
public SegmentTermDocs(SegmentReader parent)
{
this.parent = parent;
this.freqStream = (IndexInput) parent.freqStream.Clone();
this.deletedDocs = parent.deletedDocs;
this.skipInterval = parent.tis.GetSkipInterval();
}
开发者ID:zweib730,项目名称:beagrep,代码行数:7,代码来源:SegmentTermDocs.cs
示例8: TestDocument
public virtual void TestDocument()
{
SegmentReader[] readers = new SegmentReader[2];
Directory dir = NewDirectory();
Document doc1 = new Document();
Document doc2 = new Document();
DocHelper.SetupDoc(doc1);
DocHelper.SetupDoc(doc2);
DocHelper.WriteDoc(Random(), dir, doc1);
DocHelper.WriteDoc(Random(), dir, doc2);
DirectoryReader reader = DirectoryReader.Open(dir);
Assert.IsTrue(reader != null);
Assert.IsTrue(reader is StandardDirectoryReader);
Document newDoc1 = reader.Document(0);
Assert.IsTrue(newDoc1 != null);
Assert.IsTrue(DocHelper.NumFields(newDoc1) == DocHelper.NumFields(doc1) - DocHelper.Unstored.Count);
Document newDoc2 = reader.Document(1);
Assert.IsTrue(newDoc2 != null);
Assert.IsTrue(DocHelper.NumFields(newDoc2) == DocHelper.NumFields(doc2) - DocHelper.Unstored.Count);
Terms vector = reader.GetTermVectors(0).Terms(DocHelper.TEXT_FIELD_2_KEY);
Assert.IsNotNull(vector);
reader.Dispose();
if (readers[0] != null)
{
readers[0].Dispose();
}
if (readers[1] != null)
{
readers[1].Dispose();
}
dir.Dispose();
}
开发者ID:paulirwin,项目名称:lucene.net,代码行数:34,代码来源:TestDirectoryReader.cs
示例9: SetUp
public override void SetUp()
{
base.SetUp();
DocHelper.SetupDoc(testDoc);
SegmentInfo info = DocHelper.WriteDoc(dir, testDoc);
reader = SegmentReader.Get(true, info, IndexReader.DEFAULT_TERMS_INDEX_DIVISOR);
}
开发者ID:Nangal,项目名称:lucene.net,代码行数:7,代码来源:TestSegmentReader.cs
示例10: MultiSegmentReader
private int[] starts; // 1st docno for each segment
#endregion Fields
#region Constructors
/// <summary>Construct reading the named set of readers. </summary>
internal MultiSegmentReader(Directory directory, SegmentInfos sis, bool closeDirectory, bool readOnly)
: base(directory, sis, closeDirectory, readOnly)
{
// To reduce the chance of hitting FileNotFound
// (and having to retry), we open segments in
// reverse because IndexWriter merges & deletes
// the newest segments first.
SegmentReader[] readers = new SegmentReader[sis.Count];
for (int i = sis.Count - 1; i >= 0; i--)
{
try
{
readers[i] = SegmentReader.Get(readOnly, sis.Info(i));
}
catch (System.IO.IOException e)
{
// Close all readers we had opened:
for (i++; i < sis.Count; i++)
{
try
{
readers[i].Close();
}
catch (System.IO.IOException)
{
// keep going - we want to clean up as much as possible
}
}
throw e;
}
}
Initialize(readers);
}
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:42,代码来源:MultiSegmentReader.cs
示例11: AllTermDocs
protected internal AllTermDocs(SegmentReader parent)
{
lock (parent)
{
this.deletedDocs = parent.deletedDocs;
}
this.maxDoc = parent.MaxDoc();
}
开发者ID:andylaudotnet,项目名称:StockFoo,代码行数:8,代码来源:AllTermDocs.cs
示例12: SetUp
public override void SetUp()
{
base.SetUp();
Dir = NewDirectory();
DocHelper.SetupDoc(TestDoc);
SegmentCommitInfo info = DocHelper.WriteDoc(Random(), Dir, TestDoc);
Reader = new SegmentReader(info, DirectoryReader.DEFAULT_TERMS_INDEX_DIVISOR, IOContext.READ);
}
开发者ID:paulirwin,项目名称:lucene.net,代码行数:8,代码来源:TestSegmentReader.cs
示例13: SetUp
public override void SetUp()
{
base.SetUp();
DocHelper.SetupDoc(doc1);
SegmentInfo info1 = DocHelper.WriteDoc(merge1Dir, doc1);
DocHelper.SetupDoc(doc2);
SegmentInfo info2 = DocHelper.WriteDoc(merge2Dir, doc2);
reader1 = SegmentReader.Get(info1);
reader2 = SegmentReader.Get(info2);
}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:10,代码来源:TestSegmentMerger.cs
示例14: SetUp
public override void SetUp()
{
base.SetUp();
DocHelper.SetupDoc(doc1);
SegmentInfo info1 = DocHelper.WriteDoc(merge1Dir, doc1);
DocHelper.SetupDoc(doc2);
SegmentInfo info2 = DocHelper.WriteDoc(merge2Dir, doc2);
reader1 = SegmentReader.Get(true, info1, IndexReader.DEFAULT_TERMS_INDEX_DIVISOR);
reader2 = SegmentReader.Get(true, info2, IndexReader.DEFAULT_TERMS_INDEX_DIVISOR);
}
开发者ID:Nangal,项目名称:lucene.net,代码行数:10,代码来源:TestSegmentMerger.cs
示例15: SegmentTermDocs
public /*protected internal*/ SegmentTermDocs(SegmentReader parent)
{
this.parent = parent;
this.freqStream = (IndexInput) parent.core.freqStream.Clone();
lock (parent)
{
this.deletedDocs = parent.deletedDocs;
}
this.skipInterval = parent.core.GetTermsReader().GetSkipInterval();
this.maxSkipLevels = parent.core.GetTermsReader().GetMaxSkipLevels();
}
开发者ID:jhuntsman,项目名称:FlexNet,代码行数:11,代码来源:SegmentTermDocs.cs
示例16: SegmentTermDocs
/*protected internal*/
public SegmentTermDocs(SegmentReader parent)
{
this.parent = parent;
this.freqStream = (IndexInput) parent.core.freqStream.Clone();
lock (parent)
{
this.deletedDocs = parent.deletedDocs;
}
this.skipInterval = parent.core.GetTermsReader().SkipInterval;
this.maxSkipLevels = parent.core.GetTermsReader().MaxSkipLevels;
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:12,代码来源:SegmentTermDocs.cs
示例17: SetUp
public override void SetUp()
{
base.SetUp();
MergedDir = NewDirectory();
Merge1Dir = NewDirectory();
Merge2Dir = NewDirectory();
DocHelper.SetupDoc(Doc1);
SegmentCommitInfo info1 = DocHelper.WriteDoc(Random(), Merge1Dir, Doc1);
DocHelper.SetupDoc(Doc2);
SegmentCommitInfo info2 = DocHelper.WriteDoc(Random(), Merge2Dir, Doc2);
Reader1 = new SegmentReader(info1, DirectoryReader.DEFAULT_TERMS_INDEX_DIVISOR, NewIOContext(Random()));
Reader2 = new SegmentReader(info2, DirectoryReader.DEFAULT_TERMS_INDEX_DIVISOR, NewIOContext(Random()));
}
开发者ID:paulirwin,项目名称:lucene.net,代码行数:13,代码来源:TestSegmentMerger.cs
示例18: SetUp
protected virtual void SetUp()
{
try
{
DocHelper.SetupDoc(testDoc);
DocHelper.WriteDoc(dir, testDoc);
reader = new SegmentReader(new SegmentInfo("test", 1, dir));
}
catch (System.IO.IOException e)
{
}
}
开发者ID:runefs,项目名称:Marvin,代码行数:14,代码来源:TestSegmentReader.cs
示例19: TestAddDocument
public virtual void TestAddDocument()
{
Document testDoc = new Document();
DocHelper.SetupDoc(testDoc);
IndexWriter writer = new IndexWriter(Dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())));
writer.AddDocument(testDoc);
writer.Commit();
SegmentCommitInfo info = writer.NewestSegment();
writer.Dispose();
//After adding the document, we should be able to read it back in
SegmentReader reader = new SegmentReader(info, DirectoryReader.DEFAULT_TERMS_INDEX_DIVISOR, NewIOContext(Random()));
Assert.IsTrue(reader != null);
Document doc = reader.Document(0);
Assert.IsTrue(doc != null);
//System.out.println("Document: " + doc);
IndexableField[] fields = doc.GetFields("textField2");
Assert.IsTrue(fields != null && fields.Length == 1);
Assert.IsTrue(fields[0].StringValue.Equals(DocHelper.FIELD_2_TEXT));
Assert.IsTrue(fields[0].FieldType().StoreTermVectors);
fields = doc.GetFields("textField1");
Assert.IsTrue(fields != null && fields.Length == 1);
Assert.IsTrue(fields[0].StringValue.Equals(DocHelper.FIELD_1_TEXT));
Assert.IsFalse(fields[0].FieldType().StoreTermVectors);
fields = doc.GetFields("keyField");
Assert.IsTrue(fields != null && fields.Length == 1);
Assert.IsTrue(fields[0].StringValue.Equals(DocHelper.KEYWORD_TEXT));
fields = doc.GetFields(DocHelper.NO_NORMS_KEY);
Assert.IsTrue(fields != null && fields.Length == 1);
Assert.IsTrue(fields[0].StringValue.Equals(DocHelper.NO_NORMS_TEXT));
fields = doc.GetFields(DocHelper.TEXT_FIELD_3_KEY);
Assert.IsTrue(fields != null && fields.Length == 1);
Assert.IsTrue(fields[0].StringValue.Equals(DocHelper.FIELD_3_TEXT));
// test that the norms are not present in the segment if
// omitNorms is true
foreach (FieldInfo fi in reader.FieldInfos)
{
if (fi.Indexed)
{
Assert.IsTrue(fi.OmitsNorms() == (reader.GetNormValues(fi.Name) == null));
}
}
reader.Dispose();
}
开发者ID:paulirwin,项目名称:lucene.net,代码行数:49,代码来源:TestDocumentWriter.cs
示例20: Merge
internal static void Merge(System.String seg1, System.String seg2, System.String merged)
{
Directory directory = FSDirectory.GetDirectory("test", false);
SegmentReader r1 = new SegmentReader(new SegmentInfo(seg1, 1, directory));
SegmentReader r2 = new SegmentReader(new SegmentInfo(seg2, 1, directory));
SegmentMerger merger = new SegmentMerger(directory, merged, false);
merger.Add(r1);
merger.Add(r2);
merger.Merge();
merger.CloseReaders();
directory.Close();
}
开发者ID:runefs,项目名称:Marvin,代码行数:15,代码来源:DocTest.cs
注:本文中的Lucene.Net.Index.SegmentReader类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论