26 sep 2007 kl. 16.49 skrev John Wang:

I have my own versioning system and I use it to keep index in sync with other parts of the system. Just wanted to know if there is a shortcut to
keep it in the Lucene index and be able to read it by using something
similar to getCurrentVersion.
I guess I will have to store it somewhere outside of the index then.

Do you want to store your version information a file within the Lucene Directory? Then you are looking for the createOutput(String) and readInput(String) methods of Directory:

http://lucene.apache.org/java/2_2_0/api/org/apache/lucene/store/ Directory.html#createOutput(java.lang.String)



--
karl



-John

On 9/26/07, Grant Ingersoll <[EMAIL PROTECTED]> wrote:

Would IndexReader:
/**
    * Reads version number from segments files. The version number is
    * initialized with a timestamp and then increased by one for each
change of
    * the index.
    *
    * @param directory where the index resides.
    * @return version number.
    * @throws CorruptIndexException if the index is corrupt
    * @throws IOException if there is a low-level IO error
    */
   public static long getCurrentVersion(Directory directory) throws
CorruptIndexException, IOException {

do what you are looking for?  Also, why does it have to be in the
index if you are concerned about loading the whole IndexReader?  That
is, if your application is versioning the application, why not just
store it in the same location or something like that?

-Grant

On Sep 25, 2007, at 6:51 PM, John Wang wrote:

Hi:

   Is there a way to added custom signature data to a lucene index,
e.g data
version etc?

Thanks

-John

--------------------------
Grant Ingersoll
http://lucene.grantingersoll.com

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to