lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Radomir Mladenovic <>
Subject IndexReader.getVersion()
Date Wed, 25 May 2005 10:37:36 GMT

Am I missing an obvious way to return version of already opened index?

Static method IndexReader.getCurrentVersion() uses SegmentInfos to
read version number from "segments" files. This returns current
version of index in Directory but I need a reliable way to obtain
version of IndexReader.

This can be solved using some locking in higher level API. However,
all what's actually needed is a simple method addition to IndexReader:

   * Version number when this IndexReader was opened.
  public long getVersion() {
    return segmentInfos.getVersion();

that just passes version from segmentInfos instance used by
IndexReader. Is there a commiter willing to make such change please?

BTW, SigmentInfos.readCurrentVersion() reads ''segments" without
locking (COMMIT_LOCK). Is there a good reason or just an omission?

Best regards,

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

View raw message