将Lucene索引文件存储到远程位置

时间:2021-06-03 03:07:56

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 ?

你好,有没有一种方法可以将lucene索引文件存储到远程位置,例如我在PC上(a),想要索引我的文档,但是把结果存储到远程位置,比如PC上的某个目录(B),它内部支持还是我应该编写自定义代码来支持它?

many thanks to accurate response

多亏了准确的反应

2 个解决方案

#1


6  

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.

您可以直接针对以网络共享方式发布的远程文件系统使用FSDirectory.Open(@“\服务器\索引”),但是正如前面提到的,网络延迟和速度将影响您的索引。

You could also index it locally, either using a FSDirectory or a RAMDirectory, and call Directory.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.

您也可以在本地索引它,或者使用FSDirectory或RAMDirectory,以及调用目录。复制(src, dest, closeDirSrc),通过网络共享将其传输到您的远程位置。这将比直接在远程目录上工作更快,因为在索引过程中没有网络开销。

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).

如果速度没有问题,或者你有冒险精神,试着构建一个自定义目录实现(从目录继承),它将使用你需要的任何传输技术(ftp,电子邮件,信令信标等)。

#2


1  

  1. I'm not sure how you're connecting to the "remote location", but if you can mount PC(B) as part of your filesystem you can put your index there without doing anything special.
  2. 我不确定您是如何连接到“远程位置”的,但是如果您可以将PC(B)作为文件系统的一部分挂载,那么您可以将索引放在那里,而不需要做任何特殊的操作。
  3. That being said, remote filesystems are slower than local ones
  4. 也就是说,远程文件系统比本地文件系统慢

#1


6  

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.

您可以直接针对以网络共享方式发布的远程文件系统使用FSDirectory.Open(@“\服务器\索引”),但是正如前面提到的,网络延迟和速度将影响您的索引。

You could also index it locally, either using a FSDirectory or a RAMDirectory, and call Directory.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.

您也可以在本地索引它,或者使用FSDirectory或RAMDirectory,以及调用目录。复制(src, dest, closeDirSrc),通过网络共享将其传输到您的远程位置。这将比直接在远程目录上工作更快,因为在索引过程中没有网络开销。

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).

如果速度没有问题,或者你有冒险精神,试着构建一个自定义目录实现(从目录继承),它将使用你需要的任何传输技术(ftp,电子邮件,信令信标等)。

#2


1  

  1. I'm not sure how you're connecting to the "remote location", but if you can mount PC(B) as part of your filesystem you can put your index there without doing anything special.
  2. 我不确定您是如何连接到“远程位置”的,但是如果您可以将PC(B)作为文件系统的一部分挂载,那么您可以将索引放在那里,而不需要做任何特殊的操作。
  3. That being said, remote filesystems are slower than local ones
  4. 也就是说,远程文件系统比本地文件系统慢