将 Lucene 索引文件存储到远程位置
嗨
有没有办法将 lucene 索引文件存储到远程位置,例如我在 PC(A) 上,想要索引我的文档,但将结果存储到远程位置,例如 PC(B) 上的某个目录,它是内部支持的还是我应该编写自定义代码来支持它?
非常感谢准确的回复
Hi
Is there a way to store lucene index files to remote location for example I'm on PC(A) and want to index my documents but store the result to remote location like some directory on PC(B) is it supported internally or i should write custom code to support it ?
many thanks to accurate response
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有多个选项可用,具体取决于您的网络设置。
您可以直接使用
FSDirectory.Open(@"\\server\index")
作为网络共享发布的远程文件系统,但正如已经指出的,网络延迟和速度将影响您的索引。您还可以使用
FSDirectory
或RAMDirectory
在本地对其进行索引,并调用Directory.Copy(src, dest, closeDirSrc)
进行传输它通过网络共享到您的远程位置。这比直接针对远程目录工作要快,因为索引期间没有网络开销。如果速度不重要,或者您喜欢冒险,请尝试构建一个自定义目录实现(继承自
Directory
),它使用您需要的任何传输技术(ftp、电子邮件、信鸽等)。There are several options available, depending on your network setup.
You can work directly against a remote filesystem published as a network shares with
FSDirectory.Open(@"\\server\index")
, but as already been noted, network latency and speed will affect your indexing.You could also index it locally, either using a
FSDirectory
or aRAMDirectory
, and callDirectory.Copy(src, dest, closeDirSrc)
to transfer it via a network share to your remote location. This will be faster than working directly against a remote directory since there's no network overhead during indexing.If speed is of no concern, or you're feeling adventurous, try building a custom directory implementation (inherit from
Directory
) which uses whatever transfer technique you need (ftp, email, carrier pigeons, etc).