I took a first cut at creating an explicit read only IndexReader
(attached), which is an alternative to the first patch here.
I added "boolean readOnly" to 3 of the IndexReader open methods, and
created ReadOnlySegmentReader and ReadOnlyMultiSegmentReader. The
classes are trivial – they subclass the parent and just override
acquireWriteLock (to throw an exception) and isDeleted.
reopen() also preserves readOnly-ness, and I fixed merging to open readOnly
We could safely do this for a deleting-reader by pre-allocating the BitVector objects, thus eliminating the possibility of a thread seeing a partially constructed object.
I didn't do this one yet ... it makes me a bit nervous because it
means that people who just do IndexReader.open on an index with no
deletions pay the RAM cost upfront of allocating the BitVector.
Really, I think we want to default IndexReader.open to be
readOnly=true (which we can't do until 3.0) at which point doing the
above seems safer since you'd have to go out of your way to open a