简体   繁体   English

Lucene.Net IndexWriter多个应用程序

[英]Lucene.Net IndexWriter multiple application

I am currently working on a project to index a lot of documents (with a slow process) before inserting it into Lucene.Net. 在将其插入Lucene.Net之前,我目前正在研究一个索引很多文档(过程缓慢)的项目。

To make the indexation faster, I would like to duplicate the windows service to keep only one thread into my service(s). 为了更快地建立索引,我想复制Windows服务以仅将一个线程保留到我的服务中。 This means that I will have multiple IndexWriter and this is not possible because of the lock. 这意味着我将有多个IndexWriter,并且由于锁定而无法实现。 Also the services wont be on the same server this means that Shared memory is not possible. 服务也不会在同一服务器上,这意味着不可能共享内存。

Is there any way to do this safely? 有什么办法可以安全地做到这一点吗? if yes how to do it? 如果是,该怎么办?

Thanks in advance for your answers. 预先感谢您的回答。

Lenny 莱尼

Every writer should be writing to their own directory, and you can merge them together as a final step using IndexWriter.AddIndexesNoOptimize 每个作者都应该写入自己的目录,最后可以使用IndexWriter.AddIndexesNoOptimize将它们合并在一起。

Merges all segments from an array of indexes into this index. 将所有索引段中的所有段合并到该索引中。

This may be used to parallelize batch indexing. 这可用于并行化批索引。 A large document collection can be broken into sub-collections. 大型文档集合可以分为子集合。 Each sub-collection can be indexed in parallel, on a different thread, process or machine. 每个子集合可以在不同的线程,进程或机器上并行索引。 The complete index can then be created by merging sub-collection indexes with this method. 然后可以通过将子集合索引与此方法合并来创建完整索引。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM