invNonTermPerm = new int[ nonTermFrequency.length ];
for( int i = invNonTermPerm.length; i-- != 0; ) invNonTermPerm[ nonTermPerm[ i ] ] = i;
}
File newDocumentsFile = File.createTempFile( SimpleCompressedDocumentCollection.class.getSimpleName(), "temp", new File( basename.toString() ).getParentFile() );
OutputBitStream newDocumentsObs = new OutputBitStream( newDocumentsFile );
documentsIbs.position( 0 );
for( int i = (int)collection.documents; i-- != 0; ) {
readSelfDelimitedUtf8String( documentsIbs, s ); // Skip URI
SimpleCompressedDocumentCollectionBuilder.writeSelfDelimitedUtf8String( newDocumentsObs, s );
readSelfDelimitedUtf8String( documentsIbs, s ); // Skip title
SimpleCompressedDocumentCollectionBuilder.writeSelfDelimitedUtf8String( newDocumentsObs, s );
for( int f = factory.numberOfFields() - 1; f-- !=0; ) {
int len = documentsIbs.readDelta();
newDocumentsObs.writeDelta( len );
while( len-- != 0 ) {
newDocumentsObs.writeDelta( invTermPerm[ documentsIbs.readDelta() ] );
if ( exact ) newDocumentsObs.writeDelta( invNonTermPerm[ documentsIbs.readDelta() ] );
}
}
}
newDocumentsObs.close();
new File( basename + DOCUMENTS_EXTENSION ).delete();
newDocumentsFile.renameTo( new File( basename + DOCUMENTS_EXTENSION ) );
newDocumentsObs = null;
invTermPerm = invNonTermPerm = null;