lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Goller <>
Subject Re: IndexReader.getCurrentVersion() and IndexReader.lastModified()
Date Thu, 03 Jun 2004 14:07:59 GMT
Bernhard Messer wrote:
> Hi Dmitry,
> from the view of keeping the interface clean, it would be much better to 
> have a seperate method in IndexReader like "isCurrent()" or even nicer 
> "isValid()" which combines the system time of the index creation (stored 
> in SegmentInfos) and the current version number. I think the 
> implementation is not do difficult and can be done in a short period of 
> time. If wanted, i can try provide a new patch implementing a new method 
> in IndexReader "isValid()" which does exactly that.
> Bernhard

As Dmitry said, we didn´t have the case of deleted indices in mind when we
introduced the version number. I think that the solution of initializing
the version number with the current time in milliseconds is very elegant
(a minimal change with all the desired effects).

For a clean API I propose the following:
*) Keep Bernhard´s initialization of version number
*) Remove (deprecate) static IndexReader.getCurrentVersion() methods.
*) Introduce a new public non-static IndexReader member function
boolean isValid() that is similar to the current aquireLock and checks
whether the IndexReader is still valid.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message