lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Maisonneuve" <n.maisonne...@hotPop.com>
Subject Re: Copy Directory to Directory function ( backup)
Date Thu, 15 Jan 2004 13:49:27 GMT
hmm, yes
but i don't want open a indexWriter for this
and there is the performance question when the index is big

----- Original Message ----- 
From: "Karsten Konrad" <Karsten.Konrad@xtramind.com>
To: "Lucene Users List" <lucene-user@jakarta.apache.org>
Sent: Thursday, January 15, 2004 2:20 PM
Subject: AW: Copy Directory to Directory function ( backup)



Hi,

an elegant method is to create an empty directory and merge
the index to be copied into it, using .addDirectories() of
IndexWriter. This way, you do not have to deal with files
at all.

Regards,

Karsten

-----Urspr√ľngliche Nachricht-----
Von: Nicolas Maisonneuve [mailto:n.maisonneuve@hotPop.com]
Gesendet: Donnerstag, 15. Januar 2004 13:28
An: lucene-user@jakarta.apache.org
Betreff: Copy Directory to Directory function ( backup)


hy ,
i would like backup a index.

1) my first idea  is to make a system copy of all the files
but in the FSDirectory class,  there is no public method to know where is
located the directory. A simple methode like
public File getDirectoryFile() {
return directory; would be great;
}
2) so i decide to create a copy(Directory source, Directory target) method
i seen the openFile() and createFile method but after i
but i don't know how use it (see my function  , this function make a
Exception )

    private void copy (Directory source, Directory target) throws
IOException {
        String[] files=source.list();
        for(int i=0; i<files.length; i++) {
            InputStream in=source.openFile(files[i]);
            OutputStream out=target.createFile(files[i]);
            byte c;

            while((c=in.readByte())!=-1) {
                out.writeByte(c);
            }
            in.close();
            out.close();
        }

someone could help me please
nico

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





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


Mime
View raw message