@ -64,7 +64,7 @@ public class RemoteSearch extends Thread {
public RemoteSearch (
final String wordhashes , final String excludehashes ,
final String urlhashes ,
final String urlhashes , // this is the field that is filled during a secondary search to restrict to specific urls that are to be retrieved
final Pattern prefer ,
final Pattern filter ,
final Pattern snippet ,
@ -112,30 +112,30 @@ public class RemoteSearch extends Thread {
public void run ( ) {
try {
this . urls = Protocol . search (
peers. mySeed ( ) ,
wordhashes , excludehashes , urlhashes,
prefer , filter , snippet,
language , sitehash , authorhash,
count , time , maxDistance , global , partitions,
targetPeer , indexSegment , containerCache , secondarySearchSuperviser,
blacklist , rankingProfile , constraint) ;
if ( urls > = 0 ) {
this . peers. mySeed ( ) ,
this . wordhashes , this . excludehashes , this . urlhashes,
this . prefer , this . filter , this . snippet,
this . language , this . sitehash , this . authorhash,
this . count , this . time , this . maxDistance , this . global , this . partitions,
this . targetPeer , this . indexSegment , this . containerCache , this . secondarySearchSuperviser,
this . blacklist , this . rankingProfile , this . constraint) ;
if ( this . urls > = 0 ) {
// urls is an array of url hashes. this is only used for log output
if ( urlhashes ! = null & & urlhashes. length ( ) > 0 ) Network . log . logInfo ( "SECONDARY REMOTE SEARCH - remote peer " + targetPeer . hash + ":" + targetPeer. getName ( ) + " contributed " + this . urls + " links for word hash " + wordhashes) ;
peers . mySeed ( ) . incRI ( urls) ;
peers . mySeed ( ) . incRU ( urls) ;
if ( this . urlhashes ! = null & & this . urlhashes. length ( ) > 0 ) Network . log . logInfo ( "SECONDARY REMOTE SEARCH - remote peer " + this . targetPeer . hash + ":" + this . targetPeer. getName ( ) + " contributed " + this . urls + " links for word hash " + this . wordhashes) ;
this . peers . mySeed ( ) . incRI ( this . urls) ;
this . peers . mySeed ( ) . incRU ( this . urls) ;
} else {
Network . log . logInfo ( "REMOTE SEARCH - no answer from remote peer " + targetPeer . hash + ":" + targetPeer. getName ( ) ) ;
Network . log . logInfo ( "REMOTE SEARCH - no answer from remote peer " + this . targetPeer . hash + ":" + this . targetPeer. getName ( ) ) ;
}
} catch ( final Exception e ) {
Log . logException ( e ) ;
} finally {
containerCache. oneFeederTerminated ( ) ;
this . containerCache. oneFeederTerminated ( ) ;
}
}
public static String set2string ( final HandleSet hashes ) {
StringBuilder wh = new StringBuilder ( hashes . size ( ) * 12 ) ;
final StringBuilder wh = new StringBuilder ( hashes . size ( ) * 12 ) ;
final Iterator < byte [ ] > iter = hashes . iterator ( ) ;
while ( iter . hasNext ( ) ) { wh . append ( ASCII . String ( iter . next ( ) ) ) ; }
return wh . toString ( ) ;
@ -150,7 +150,7 @@ public class RemoteSearch extends Thread {
}
public Seed target ( ) {
return targetPeer;
return this . targetPeer;
}
public static RemoteSearch [ ] primaryRemoteSearches (
@ -159,7 +159,7 @@ public class RemoteSearch extends Thread {
final String language ,
final String sitehash ,
final String authorhash ,
final int count , long time , final int maxDist ,
final int count , final long time , final int maxDist ,
final Segment indexSegment ,
final SeedDB peers ,
final RWIProcess containerCache ,
@ -186,7 +186,7 @@ public class RemoteSearch extends Thread {
burstMultiwordPercent )
: PeerSelection . selectClusterPeers ( peers , clusterselection ) ;
if ( targetPeers = = null ) return new RemoteSearch [ 0 ] ;
int targets = targetPeers . length ;
final int targets = targetPeers . length ;
if ( targets = = 0 ) return new RemoteSearch [ 0 ] ;
final RemoteSearch [ ] searchThreads = new RemoteSearch [ targets ] ;
for ( int i = 0 ; i < targets ; i + + ) {
@ -198,7 +198,7 @@ public class RemoteSearch extends Thread {
count , time , maxDist , true , targets , targetPeers [ i ] ,
indexSegment , peers , containerCache , secondarySearchSuperviser , blacklist , rankingProfile , constraint ) ;
searchThreads [ i ] . start ( ) ;
} catch ( OutOfMemoryError e ) {
} catch ( final OutOfMemoryError e ) {
Log . logException ( e ) ;
break ;
}