Retrieving a specified version of a document
This section explains how to extract a previous version of a document. This may be useful in order to view a previous version and roll back to that previous version. You can then delete the subsequent versions that you no longer need.
Getting a document by its name shows how to retrieve a document when you know its name (i.e., its unique identifier).
Generating a list of document versions shows how to determine whether a document has more than one version, and how to retrieve a list of previous version numbers.
Once you know a document's name and the version number you wish to retrieve, you can
retrieve the content, properties, and so forth by appending a semi-colon
(;
)and the version number to the name.
For example, to modify GetDocument.java sample program so that it retrieves version 1 of the document (rather than the current version), make this change to one line:
// Original program retrieves the current version of one document:
documents[0] = documentName;
// Modified program retrieves Version 1 of the document:
documents[0] = documentName+";1";
Here are the properties retrieved from Version 1 of 20000703TS0000001440.XML, a document in SampleNewsDocbase. For this example, we created two additional versions of the document.
?<?xml version='1.0' encoding='UTF-16'?>
<documentproperties>
<systemproperties>
<collection>/</collection>
<name>20000703TS0000001440.XML</name>
<version>1</version>
<size>23282</size>
<indexable>true</indexable>
<textmldoctype>TEXTML_DOCUMENT</textmldoctype>
<storagetype>TEXT_BE</storagetype>
<mimetype>text/xml</mimetype>
<creatorinfo>
<user>anyuser@anydomain</user>
<time>12:27:46</time>
<date>2010-08-25</date>
</creatorinfo>
<modifierinfo>
<user>anyuser@anydomain</user>
<time>15:02:56</time>
<date>2010-09-29</date>
</modifierinfo>
</systemproperties>
<otherproperties>
<versionsinfo>
<currentdocumentversion>3</currentdocumentversion>
<previousversionscount>2</previousversionscount>
<previousversionstotalsize>46564</previousversionstotalsize>
</versionsinfo>
</otherproperties>
</documentproperties>