@ -293,10 +293,12 @@ public final class Fulltext implements Iterable<byte[]> {
if ( this . connectedSolr ( ) ) {
if ( this . connectedSolr ( ) ) {
try {
try {
if ( this . urlIndexFile ! = null ) this . urlIndexFile . remove ( idb ) ;
if ( this . urlIndexFile ! = null ) this . urlIndexFile . remove ( idb ) ;
synchronized ( this . solr ) {
SolrDocument sd = this . solr . get ( id ) ;
SolrDocument sd = this . solr . get ( id ) ;
if ( sd = = null | | this . solrScheme . getDate ( sd , YaCySchema . last_modified ) . before ( this . solrScheme . getDate ( doc , YaCySchema . last_modified ) ) ) {
if ( sd = = null | | this . solrScheme . getDate ( sd , YaCySchema . last_modified ) . before ( this . solrScheme . getDate ( doc , YaCySchema . last_modified ) ) ) {
this . solr . add ( doc ) ;
this . solr . add ( doc ) ;
}
}
}
} catch ( SolrException e ) {
} catch ( SolrException e ) {
throw new IOException ( e . getMessage ( ) , e ) ;
throw new IOException ( e . getMessage ( ) , e ) ;
}
}
@ -334,10 +336,12 @@ public final class Fulltext implements Iterable<byte[]> {
if ( this . connectedSolr ( ) ) {
if ( this . connectedSolr ( ) ) {
try {
try {
if ( this . urlIndexFile ! = null ) this . urlIndexFile . remove ( idb ) ;
if ( this . urlIndexFile ! = null ) this . urlIndexFile . remove ( idb ) ;
synchronized ( this . solr ) {
SolrDocument sd = this . solr . get ( id ) ;
SolrDocument sd = this . solr . get ( id ) ;
if ( sd = = null | | ( new URIMetadataNode ( sd ) ) . isOlder ( row ) ) {
if ( sd = = null | | ( new URIMetadataNode ( sd ) ) . isOlder ( row ) ) {
this . solr . add ( getSolrScheme ( ) . metadata2solr ( row ) ) ;
this . solr . add ( getSolrScheme ( ) . metadata2solr ( row ) ) ;
}
}
}
} catch ( SolrException e ) {
} catch ( SolrException e ) {
throw new IOException ( e . getMessage ( ) , e ) ;
throw new IOException ( e . getMessage ( ) , e ) ;
}
}
@ -365,7 +369,9 @@ public final class Fulltext implements Iterable<byte[]> {
public boolean remove ( final byte [ ] urlHash ) {
public boolean remove ( final byte [ ] urlHash ) {
if ( urlHash = = null ) return false ;
if ( urlHash = = null ) return false ;
try {
try {
synchronized ( this . solr ) {
this . solr . delete ( ASCII . String ( urlHash ) ) ;
this . solr . delete ( ASCII . String ( urlHash ) ) ;
}
} catch ( final Throwable e ) {
} catch ( final Throwable e ) {
Log . logException ( e ) ;
Log . logException ( e ) ;
}
}
@ -470,8 +476,9 @@ public final class Fulltext implements Iterable<byte[]> {
EmbeddedSolrConnector esc = ( EmbeddedSolrConnector ) this . solr . getSolr0 ( ) ;
EmbeddedSolrConnector esc = ( EmbeddedSolrConnector ) this . solr . getSolr0 ( ) ;
int commitWithin = esc . getCommitWithinMs ( ) ;
int commitWithin = esc . getCommitWithinMs ( ) ;
File storagePath = esc . getStoragePath ( ) ;
File storagePath = esc . getStoragePath ( ) ;
this . disconnectLocalSolr ( ) ;
File zipOut = new File ( storagePath . toString ( ) + "_" + GenericFormatter . SHORT_DAY_FORMATTER . format ( ) + ".zip" ) ;
File zipOut = new File ( storagePath . toString ( ) + "_" + GenericFormatter . SHORT_DAY_FORMATTER . format ( ) + ".zip" ) ;
synchronized ( this . solr ) {
this . disconnectLocalSolr ( ) ;
try {
try {
ZIPWriter . zip ( storagePath , zipOut ) ;
ZIPWriter . zip ( storagePath , zipOut ) ;
} catch ( IOException e ) {
} catch ( IOException e ) {
@ -483,6 +490,7 @@ public final class Fulltext implements Iterable<byte[]> {
Log . logException ( e ) ;
Log . logException ( e ) ;
}
}
}
}
}
return zipOut ;
return zipOut ;
}
}
@ -494,6 +502,7 @@ public final class Fulltext implements Iterable<byte[]> {
EmbeddedSolrConnector esc = ( EmbeddedSolrConnector ) this . solr . getSolr0 ( ) ;
EmbeddedSolrConnector esc = ( EmbeddedSolrConnector ) this . solr . getSolr0 ( ) ;
int commitWithin = esc . getCommitWithinMs ( ) ;
int commitWithin = esc . getCommitWithinMs ( ) ;
File storagePath = esc . getStoragePath ( ) ;
File storagePath = esc . getStoragePath ( ) ;
synchronized ( this . solr ) {
this . disconnectLocalSolr ( ) ;
this . disconnectLocalSolr ( ) ;
try {
try {
ZIPReader . unzip ( solrDumpZipFile , storagePath ) ;
ZIPReader . unzip ( solrDumpZipFile , storagePath ) ;
@ -507,6 +516,7 @@ public final class Fulltext implements Iterable<byte[]> {
}
}
}
}
}
}
}
// export methods
// export methods
public Export export ( final File f , final String filter , final HandleSet set , final int format , final boolean dom ) {
public Export export ( final File f , final String filter , final HandleSet set , final int format , final boolean dom ) {
@ -783,7 +793,9 @@ public final class Fulltext implements Iterable<byte[]> {
// first collect all url hashes that belong to the domain
// first collect all url hashes that belong to the domain
assert hosthash . length ( ) = = 6 ;
assert hosthash . length ( ) = = 6 ;
// delete in solr
// delete in solr
synchronized ( this . solr ) {
this . solr . deleteByQuery ( YaCySchema . host_id_s . name ( ) + ":\"" + hosthash + "\"" ) ;
this . solr . deleteByQuery ( YaCySchema . host_id_s . name ( ) + ":\"" + hosthash + "\"" ) ;
}
// delete in old metadata structure
// delete in old metadata structure
final ArrayList < String > l = new ArrayList < String > ( ) ;
final ArrayList < String > l = new ArrayList < String > ( ) ;