本文整理汇总了C#中Lucene.Net.Index.DocumentsWriter类的典型用法代码示例。如果您正苦于以下问题:C# DocumentsWriter类的具体用法?C# DocumentsWriter怎么用?C# DocumentsWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DocumentsWriter类属于Lucene.Net.Index命名空间,在下文中一共展示了DocumentsWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: closeDocStore
internal override void closeDocStore(DocumentsWriter.FlushState state)
{
lock (this)
{
int inc = state.numDocsInStore - lastDocID;
if (inc > 0)
{
initFieldsWriter();
fill(state.numDocsInStore - docWriter.GetDocStoreOffset());
}
if (fieldsWriter != null)
{
fieldsWriter.Close();
fieldsWriter = null;
lastDocID = 0;
System.Diagnostics.Debug.Assert(state.docStoreSegmentName != null);
string fdtFile = state.docStoreSegmentName + "." + IndexFileNames.FIELDS_EXTENSION;
string fdxFile = state.docStoreSegmentName + "." + IndexFileNames.FIELDS_INDEX_EXTENSION;
state.flushedFiles[fdtFile] = fdtFile;
state.flushedFiles[fdxFile] = fdxFile;
state.docWriter.RemoveOpenFile(fdtFile);
state.docWriter.RemoveOpenFile(fdxFile);
if (4 + state.numDocsInStore * 8 != state.directory.FileLength(fdxFile))
throw new System.SystemException("after flush: fdx size mismatch: " + state.numDocsInStore + " docs vs " + state.directory.FileLength(fdxFile) + " length in bytes of " + fdxFile);
}
}
}
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:32,代码来源:StoredFieldsWriter.cs
示例2: DocFieldProcessor
public DocFieldProcessor(DocumentsWriter docWriter, DocFieldConsumer consumer)
{
this.docWriter = docWriter;
this.consumer = consumer;
consumer.SetFieldInfos(fieldInfos);
fieldsWriter = new StoredFieldsWriter(docWriter, fieldInfos);
}
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:7,代码来源:DocFieldProcessor.cs
示例3: GetAndLock
public override ThreadState GetAndLock(Thread requestingThread, DocumentsWriter documentsWriter)
{
ThreadState threadState = null;
if (ActiveThreadState == 0)
{
lock (this)
{
if (ActiveThreadState == 0)
{
threadState = States[0] = NewThreadState();
return threadState;
}
}
}
Debug.Assert(ActiveThreadState > 0);
for (int i = 0; i < MaxRetry; i++)
{
int ord = Random.Next(ActiveThreadState);
lock (this)
{
threadState = States[ord];
Debug.Assert(threadState != null);
}
if (threadState.TryLock())
{
return threadState;
}
if (Random.Next(20) == 0)
{
break;
}
}
/*
* only try to create a new threadstate if we can not lock the randomly
* selected state. this is important since some tests rely on a single
* threadstate in the single threaded case. Eventually it would be nice if
* we would not have this limitation but for now we just make sure we only
* allocate one threadstate if indexing is single threaded
*/
lock (this)
{
ThreadState newThreadState = NewThreadState();
if (newThreadState != null) // did we get a new state?
{
threadState = States[ActiveThreadState - 1] = newThreadState;
//Debug.Assert(threadState.HeldByCurrentThread);
return threadState;
}
// if no new state is available lock the random one
}
Debug.Assert(threadState != null);
[email protected]();
return threadState;
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:56,代码来源:RandomDocumentsWriterPerThreadPool.cs
示例4: DocumentsWriterThreadState
internal int numThreads = 1; // Number of threads that share this instance
#endregion Fields
#region Constructors
public DocumentsWriterThreadState(DocumentsWriter docWriter)
{
this.docWriter = docWriter;
docState = new DocumentsWriter.DocState();
docState.maxFieldLength = docWriter.maxFieldLength;
docState.infoStream = docWriter.infoStream;
docState.similarity = docWriter.similarity;
docState.docWriter = docWriter;
consumer = docWriter.consumer.AddThread(this);
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:16,代码来源:DocumentsWriterThreadState.cs
示例5: closeDocStore
internal override void closeDocStore(DocumentsWriter.FlushState state)
{
try
{
one.closeDocStore(state);
}
finally
{
two.closeDocStore(state);
}
}
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:11,代码来源:DocFieldConsumers.cs
示例6: DocumentsWriterThreadState
internal int numThreads = 1; // Number of threads that share this instance
#endregion Fields
#region Constructors
public DocumentsWriterThreadState(DocumentsWriter docWriter)
{
this.docWriter = docWriter;
docState = new DocumentsWriter.DocState();
docState.maxFieldLength = docWriter.maxFieldLength;
docState.infoStream = docWriter.infoStream;
docState.similarity = docWriter.similarity;
docState.docWriter = docWriter;
docState.allowMinus1Position = docWriter.writer.GetAllowMinus1Position();
consumer = docWriter.consumer.AddThread(this);
}
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:17,代码来源:DocumentsWriterThreadState.cs
示例7: SegmentWriteState
public SegmentWriteState(DocumentsWriter docWriter, Directory directory, System.String segmentName, System.String docStoreSegmentName, int numDocs, int numDocsInStore, int termIndexInterval)
{
this.docWriter = docWriter;
this.directory = directory;
this.segmentName = segmentName;
this.docStoreSegmentName = docStoreSegmentName;
this.numDocs = numDocs;
this.numDocsInStore = numDocsInStore;
this.termIndexInterval = termIndexInterval;
flushedFiles = new Support.Set<string>();
}
开发者ID:jhuntsman,项目名称:FlexNet,代码行数:11,代码来源:SegmentWriteState.cs
示例8: flush
//internal override void flush(/*IDictionary*/ IDictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> threadsAndFields, DocumentsWriter.FlushState state)
internal override void flush(/*IDictionary*/ IDictionary<object, ICollection<object>> threadsAndFields, DocumentsWriter.FlushState state)
{
//IDictionary oneThreadsAndFields = new Dictionary();
//IDictionary twoThreadsAndFields = new Dictionary();
//IDictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> oneThreadsAndFields = new Dictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>>();
//IDictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> twoThreadsAndFields = new Dictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>>();
IDictionary<object, ICollection<object>> oneThreadsAndFields = new Dictionary<object, ICollection<object>>();
IDictionary<object, ICollection<object>> twoThreadsAndFields = new Dictionary<object, ICollection<object>>();
//IEnumerator it = threadsAndFields.GetEnumerator();
//IEnumerator<KeyValuePair<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>>> it = threadsAndFields.GetEnumerator();
IEnumerator<KeyValuePair<object, ICollection<object>>> it = threadsAndFields.GetEnumerator();
while (it.MoveNext())
{
//KeyValuePair entry = it.Current;
//KeyValuePair<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> entry = it.Current;
KeyValuePair<object, ICollection<object>> entry = it.Current;
//DocFieldConsumersPerThread perThread = (DocFieldConsumersPerThread)entry.Key;
DocFieldConsumersPerThread perThread = (DocFieldConsumersPerThread)entry.Key;
//ICollection fields = (ICollection)entry.Value;
//ICollection<DocFieldConsumerPerField> fields = entry.Value;
ICollection<object> fields = entry.Value;
//IEnumerator fieldsIt = fields.GetEnumerator();
//IEnumerator<DocFieldConsumerPerField> fieldsIt = fields.GetEnumerator();
IEnumerator<object> fieldsIt = fields.GetEnumerator();
//IDictionary oneFields = new Dictionary();
//IDictionary twoFields = new Dictionary();
//IDictionary<DocFieldConsumerPerField, DocFieldConsumerPerField> oneFields = new Dictionary<DocFieldConsumerPerField, DocFieldConsumerPerField>();
//IDictionary<DocFieldConsumerPerField, DocFieldConsumerPerField> twoFields = new Dictionary<DocFieldConsumerPerField, DocFieldConsumerPerField>();
IDictionary<object, object> oneFields = new Dictionary<object, object>();
IDictionary<object, object> twoFields = new Dictionary<object, object>();
while (fieldsIt.MoveNext())
{
DocFieldConsumersPerField perField = (DocFieldConsumersPerField)fieldsIt.Current;
oneFields[perField.one] = perField.one;
twoFields[perField.two] = perField.two;
}
oneThreadsAndFields[perThread.one] = oneFields.Keys;
twoThreadsAndFields[perThread.two] = twoFields.Keys;
}
one.flush(oneThreadsAndFields, state);
two.flush(twoThreadsAndFields, state);
}
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:51,代码来源:DocFieldConsumers.cs
示例9: TermsHash
public TermsHash(DocumentsWriter docWriter, bool trackAllocations, TermsHashConsumer consumer, TermsHash nextTermsHash)
{
this.docWriter = docWriter;
this.consumer = consumer;
this.nextTermsHash = nextTermsHash;
this.trackAllocations = trackAllocations;
// Why + 4*POINTER_NUM_BYTE below?
// +1: Posting is referenced by postingsFreeList array
// +3: Posting is referenced by hash, which
// targets 25-50% fill factor; approximate this
// as 3X # pointers
bytesPerPosting = consumer.BytesPerPosting() + 4 * DocumentsWriter.POINTER_NUM_BYTE;
postingsFreeChunk = (int) (DocumentsWriter.BYTE_BLOCK_SIZE / bytesPerPosting);
}
开发者ID:Rationalle,项目名称:ravendb,代码行数:15,代码来源:TermsHash.cs
示例10: Flush
internal override void Flush(ICollection<object> threads, DocumentsWriter.FlushState state)
{
IDictionary<object, ICollection<object>> childThreadsAndFields = new Dictionary<object, ICollection<object>>();
IEnumerator<object> it = threads.GetEnumerator();
while (it.MoveNext())
{
DocFieldProcessorPerThread perThread = (DocFieldProcessorPerThread)it.Current;
childThreadsAndFields[perThread.consumer] = perThread.Fields();
perThread.trimFields(state);
}
consumer.flush(childThreadsAndFields, state);
// Important to save after asking consumer to flush so
// consumer can alter the FieldInfo* if necessary. EG,
// FreqProxTermsWriter does this with
// FieldInfo.storePayload.
fieldInfos.Write(state.directory, state.segmentName + ".fnm");
}
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:19,代码来源:DocFieldProcessor.cs
示例11: flush
//internal override void flush(IDictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> threadsAndFields, DocumentsWriter.FlushState state)
internal override void flush(IDictionary<object, ICollection<object>> threadsAndFields, DocumentsWriter.FlushState state)
{
//IDictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> childThreadsAndFields = new Dictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>>();
//IDictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> endChildThreadsAndFields = new Dictionary<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>>();
IDictionary<object, ICollection<object>> childThreadsAndFields = new Dictionary<object, ICollection<object>>();
IDictionary<object, ICollection<object>> endChildThreadsAndFields = new Dictionary<object, ICollection<object>>();
//IEnumerator<KeyValuePair<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>>> it = threadsAndFields.GetEnumerator();
IEnumerator<KeyValuePair<object, ICollection<object>>> it = threadsAndFields.GetEnumerator();
while (it.MoveNext())
{
//KeyValuePair<DocFieldConsumerPerThread, ICollection<DocFieldConsumerPerField>> entry = it.Current;
KeyValuePair<object, ICollection<object>> entry = it.Current;
DocInverterPerThread perThread = (DocInverterPerThread)entry.Key;
//ICollection<DocFieldConsumerPerField> fields = entry.Value;
ICollection<object> fields = entry.Value;
//IEnumerator<DocFieldConsumerPerField> fieldsIt = fields.GetEnumerator();
IEnumerator<object> fieldsIt = fields.GetEnumerator();
//IDictionary<DocFieldConsumerPerField, DocFieldConsumerPerField> childFields = new Dictionary<DocFieldConsumerPerField, DocFieldConsumerPerField>();
//IDictionary<DocFieldConsumerPerField, DocFieldConsumerPerField> endChildFields = new Dictionary<DocFieldConsumerPerField, DocFieldConsumerPerField>();
IDictionary<object, object> childFields = new Dictionary<object, object>();
IDictionary<object, object> endChildFields = new Dictionary<object, object>();
while (fieldsIt.MoveNext())
{
DocInverterPerField perField = (DocInverterPerField)fieldsIt.Current;
childFields[perField.consumer] = perField.consumer;
endChildFields[perField.endConsumer] = perField.endConsumer;
}
childThreadsAndFields[perThread.consumer] = childFields.Keys;
// create new collection to provide for deletions in NormsWriter
endChildThreadsAndFields[perThread.endConsumer] = new List<object>(endChildFields.Keys);
}
consumer.flush(childThreadsAndFields, state);
endConsumer.flush(endChildThreadsAndFields, state);
}
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:42,代码来源:DocInverter.cs
示例12: GetAndLock
public override ThreadState GetAndLock(Thread requestingThread, DocumentsWriter documentsWriter)
{
ThreadState threadState;
ThreadBindings.TryGetValue(requestingThread, out threadState);
if (threadState != null && threadState.TryLock())
{
return threadState;
}
ThreadState minThreadState = null;
/* TODO -- another thread could lock the minThreadState we just got while
we should somehow prevent this. */
// Find the state that has minimum number of threads waiting
minThreadState = MinContendedThreadState();
if (minThreadState == null || minThreadState.HasQueuedThreads)
{
ThreadState newState = NewThreadState(); // state is already locked if non-null
if (newState != null)
{
//Debug.Assert(newState.HeldByCurrentThread);
ThreadBindings[requestingThread] = newState;
return newState;
}
else if (minThreadState == null)
{
/*
* no new threadState available we just take the minContented one
* this must return a valid thread state since we accessed the
* synced context in newThreadState() above.
*/
minThreadState = MinContendedThreadState();
}
}
Debug.Assert(minThreadState != null, "ThreadState is null");
[email protected]();
return minThreadState;
}
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:38,代码来源:ThreadAffinityDocumentsWriterThreadPool.cs
示例13: ByteBlockAllocator
internal ByteBlockAllocator(DocumentsWriter enclosing_instance)
{
this.enclosing_instance = enclosing_instance;
}
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:4,代码来源:DocumentsWriter.cs
示例14: StoredFieldsWriterPerThread
public StoredFieldsWriterPerThread(DocumentsWriter.DocState docState, StoredFieldsWriter storedFieldsWriter)
{
this.storedFieldsWriter = storedFieldsWriter;
this.docState = docState;
localFieldsWriter = new FieldsWriter((IndexOutput) null, (IndexOutput) null, storedFieldsWriter.fieldInfos);
}
开发者ID:Rationalle,项目名称:ravendb,代码行数:6,代码来源:StoredFieldsWriterPerThread.cs
示例15: TermVectorsTermsWriter
public TermVectorsTermsWriter(DocumentsWriter docWriter)
{
InitBlock();
this.docWriter = docWriter;
}
开发者ID:jhuntsman,项目名称:FlexNet,代码行数:5,代码来源:TermVectorsTermsWriter.cs
示例16: StoredFieldsWriter
public StoredFieldsWriter(DocumentsWriter docWriter, FieldInfos fieldInfos)
{
InitBlock();
this.docWriter = docWriter;
this.fieldInfos = fieldInfos;
}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:6,代码来源:StoredFieldsWriter.cs
示例17: GetChain
internal abstract DocConsumer GetChain(DocumentsWriter documentsWriter);
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:1,代码来源:DocumentsWriter.cs
示例18: InitBlock
private void InitBlock(DocumentsWriter enclosingInstance)
{
this.enclosingInstance = enclosingInstance;
}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:4,代码来源:DocumentsWriter.cs
示例19: PerDocBuffer
public PerDocBuffer(DocumentsWriter enclosingInstance)
{
this.enclosingInstance = enclosingInstance;
}
开发者ID:jhuntsman,项目名称:FlexNet,代码行数:4,代码来源:DocumentsWriter.cs
示例20: ByteBlockAllocator
public ByteBlockAllocator(DocumentsWriter enclosingInstance)
{
InitBlock(enclosingInstance);
}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:4,代码来源:DocumentsWriter.cs
注:本文中的Lucene.Net.Index.DocumentsWriter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论