lucene-dev mailing list archives

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

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,
Radomir

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message