Sri,

As Lucene.Net is a port of Lucene the plan is not to add any additional 
features that don't exist in Java Lucene (other than perhaps features that 
might make usage with .NET easier). 

Search functionality is expected to be fast and encryption would certainly slow 
it down. In general, I would say this isn't a good candidate for a feature. 
That said, you should be discussing new features with the Lucene (Java) team, 
not here.

------------------------------------------------------------------------------------

Lucene.Net does have extensibility that can accommodate encryption though - you 
can create your own codec to store data in any format you want. You can supply 
your own codec by creating a custom codec factory that subclasses 
DefaultCodecFactory and setting it by using the following line at application 
startup:

Codec.SetCodecFactory(new MyCodecFactory());

You need to subclass the Codec class to provide your codec implementation. You 
can either use convention-based naming or override the name with the 
[CodecName("My")] attribute. To use convention-based naming, the codec class 
name should end with a "Codec" suffix. The name that will be used within 
Lucene.Net and stored inside of your index will be the class name excluding the 
suffix. For example, if your codec class is named MyCodec, the name used for 
Lucene.Net will by "My" unless it is overridden with the [CodecName] attribute.

In your custom codec factory's constructor (MyCodecFactory), you should then 
call either PutCodecType(Type) or ScanForCodecs(Assembly) to make Lucene.Net 
recognize your custom codec type. You can optionally provide the codec via 
dependency injection by overriding GetCodec(Type) (codecs should all be 
singleton instances), which allows you to create codecs with injected 
constructor arguments.

There are 2 additional extension points for DocValuesFormat and PostingsFormat 
that each have their own factory that you would use similarly to supplying a 
custom codec, though I am not sure whether they would be required since you can 
just return them from your custom Codec type. You really only need to use this 
if you plan on using these formats in more than one codec.

You can also override existing codecs by using the same names as the ones in 
Lucene.Net, so you could in theory apply encryption to existing codecs by 
subclassing them, tweaking their implementation, and using the [CodecName] 
attribute with the same name.

See the Java API documentation for more information about how you might write 
your own codec format: 
https://lucene.apache.org/core/4_8_0/core/org/apache/lucene/codecs/package-summary.html

Thanks,
Shad Storhaug (NightOwl888)



-----Original Message-----
From: Srini V [mailto:[email protected]] 
Sent: Monday, May 8, 2017 11:10 PM
To: [email protected]
Subject: Encrypting Index files

Team,  Did we thought of encrypting index files for security.

Thanks
Sri

Reply via email to