2

Is there a way to use a virtual filesystem with Lucene.NET? Based on my (moderate) experience with Lucene, I suspect the answer here is no; but just in case (...) barring that:

Or is there an existing Contrib module or add-on for Lucene.NET that adds VFS support?

Mauricio Scheffer
  • 98,863
  • 23
  • 192
  • 275
Rex M
  • 142,167
  • 33
  • 283
  • 313
  • Can you explain a bit more? Also, what do you intend to solve with this? – Mauricio Scheffer Jul 12 '11 at 22:47
  • @Mauricio Lucene seems to require references to objects like System.IO.Directory to function. I am in an environment where I don't have direct access to the physical disk space, I need to be able to hand it a virtualized file system provider that routes to an arbitrary store. – Rex M Jul 12 '11 at 22:49
  • @Mauricio for a very crude example, I should be able to hand it a Stream (or a StreamProvider) instead of a Directory that it writes to. – Rex M Jul 12 '11 at 22:51

1 Answers1

2

You can do this by implementing Lucene.Net.Store.Directory. The xmldoc for this abstract class is very didactic:

A Directory is a flat list of files. Files may be written once, when they are created. Once a file is created it may only be opened for read, or deleted. Random access is permitted both when reading and writing.

Java's i/o APIs not used directly, but rather all i/o is through this API. This permits things such as:

  • implementation of RAM-based indices;
  • implementation indices stored in a database, via JDBC;
  • implementation of an index as a single file;

Directory locking is implemented by an instance of LockFactory, and can be changed for each Directory instance using setLockFactory.

Here's an example of implementing a custom Directory to support Azure.

Community
  • 1
  • 1
Mauricio Scheffer
  • 98,863
  • 23
  • 192
  • 275