Store Lucene index file to remote location
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 in开发者_JAVA技巧ternally or i should write custom code to support it ?many thanks to accurate response
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 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.
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).
- 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.
- That being said, remote filesystems are slower than local ones
精彩评论