rclabo commented on issue #403:
URL: https://github.com/apache/lucenenet/issues/403#issuecomment-765383722
@NightOwl888 The more I think about this, it's kinda interesting. If one
uses an IndexWriter to open the index and then obtains a NRT reader from the
IndexWriter then the codec gets hard coded via either
`indexConfig.Codec = new Lucene46HighCompressionCodec();`
or
`indexConfig.Codec = Codec.ForName("Lucene46HighCompression");`
But if one obtains a reader via `DirectoryReader aReader =
DirectoryReader.Open(indexDir); ` then the codec used is selected dynamically
based on the codec name stored in the index header.
It makes sensed that when obtaining a writer for a new index the codec would
need to be explicitly stated in code, but it's odd that when obtaining a writer
for an _existing index_ the codec is not obtained dynamically based on the
codec in the header of the index. Isn't that lack of symmetry in the design
kinda odd? (I realize this statement is not about Lucene.Net per se but about
Java Lucene design.)
To give flexibility to NRT readers (obtained from an `IndexWriter`) to open
indexes with different codecs, it seems there is probably an easy way to read
the codec name from the header so that the name could be used in `
`indexConfig.Codec = Codec.ForName(nameReadFromHeader);``.
Is there an existing API to get this codec name from the header?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]