本文整理汇总了C#中Lucene.Net.Index.SegmentInfo.SizeInBytes方法的典型用法代码示例。如果您正苦于以下问题:C# SegmentInfo.SizeInBytes方法的具体用法?C# SegmentInfo.SizeInBytes怎么用?C# SegmentInfo.SizeInBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lucene.Net.Index.SegmentInfo
的用法示例。
在下文中一共展示了SegmentInfo.SizeInBytes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Size
protected internal override long Size(SegmentInfo info)
{
return info.SizeInBytes();
}
示例2: Flush
/// <summary>Flush all pending docs to a new segment </summary>
internal int Flush(bool closeDocStore)
{
lock (this)
{
System.Diagnostics.Debug.Assert(AllThreadsIdle());
System.Diagnostics.Debug.Assert(numDocsInRAM > 0);
System.Diagnostics.Debug.Assert(nextDocID == numDocsInRAM);
System.Diagnostics.Debug.Assert(waitQueue.numWaiting == 0);
System.Diagnostics.Debug.Assert(waitQueue.waitingBytes == 0);
InitFlushState(false);
docStoreOffset = numDocsInStore;
if (infoStream != null)
Message("flush postings as segment " + flushState.segmentName + " numDocs=" + numDocsInRAM);
bool success = false;
try
{
if (closeDocStore)
{
System.Diagnostics.Debug.Assert(flushState.docStoreSegmentName != null);
System.Diagnostics.Debug.Assert(flushState.docStoreSegmentName.Equals(flushState.segmentName));
CloseDocStore();
flushState.numDocsInStore = 0;
}
System.Collections.Hashtable threads = new System.Collections.Hashtable();
for (int i = 0; i < threadStates.Length; i++)
threads[threadStates[i].consumer] = threadStates[i].consumer;
consumer.Flush(threads, flushState);
if (infoStream != null)
{
SegmentInfo si = new SegmentInfo(flushState.segmentName, flushState.numDocs, directory);
long newSegmentSize = si.SizeInBytes();
System.String message = System.String.Format(nf, " oldRAMSize={0:d} newFlushedSize={1:d} docs/MB={2:f} new/old={3:%}",
new System.Object[] { numBytesUsed, newSegmentSize, (numDocsInRAM / (newSegmentSize / 1024.0 / 1024.0)), (100.0 * newSegmentSize / numBytesUsed) });
Message(message);
}
flushedDocCount += flushState.numDocs;
DoAfterFlush();
success = true;
}
finally
{
if (!success)
{
Abort();
}
}
System.Diagnostics.Debug.Assert(waitQueue.waitingBytes == 0);
return flushState.numDocs;
}
}
示例3: SizeBytes
protected internal virtual long SizeBytes(SegmentInfo info)
{
long byteSize = info.SizeInBytes();
if (calibrateSizeByDeletes)
{
int delCount = writer.NumDeletedDocs(info);
float delRatio = (info.docCount <= 0?0.0f:((float) delCount / (float) info.docCount));
return (info.docCount <= 0?byteSize:(long) (byteSize * (1.0f - delRatio)));
}
else
{
return byteSize;
}
}