Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fixes to search debugging after testing with the different search debugging options

Michael Peter Christen25300913fa4c
diff --git a/defaults/yacy.init b/defaults/yacy.init
index 038ac0eeb..4d60a698f 100644
--- a/defaults/yacy.init
+++ b/defaults/yacy.init
@@ -446,7 +446,7 @@ seedScpPath=
peerCycle=2
# debug flags
-debug.search.local.dht.on=false
+debug.search.local.dht.off=false
debug.search.local.solr.off=false
debug.search.remote.dht.off=false
debug.search.remote.dht.testlocal=false
diff --git a/htroot/ConfigProperties_p.html b/htroot/ConfigProperties_p.html
index 292d4624d..39e4a767f 100644
--- a/htroot/ConfigProperties_p.html
+++ b/htroot/ConfigProperties_p.html
@@ -49,7 +49,7 @@
<p>
For explanation please look into defaults/yacy.init
</p>
- <select name="options" size="25" style="width: 600px">
+ <select name="options" size="36" style="width: 600px">
#{options}#
<option id="k#[key]#" value="#[value]#" onclick="element_clicked(this)">#[key]#: #[value]#</option>
#{/options}#
diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.java
index 824aa8a10..dc02cce35 100644
--- a/source/net/yacy/peers/Protocol.java
+++ b/source/net/yacy/peers/Protocol.java
@@ -627,6 +627,8 @@ public final class Protocol {
final long timestamp = System.currentTimeMillis();
event.addExpectedRemoteReferences(count);
SearchResult result;
+ String clusteraddress = target.getClusterAddress();
+ if (clusteraddress.equals(event.peers.mySeed().getClusterAddress())) clusteraddress = "localhost:" + event.peers.mySeed().getPort();
try {
result =
new SearchResult(
@@ -642,7 +644,7 @@ public final class Protocol {
maxDistance,
partitions,
target.getHexHash() + ".yacyh",
- target.getClusterAddress(),
+ clusteraddress,
secondarySearchSuperviser
);
} catch ( final IOException e ) {
diff --git a/source/net/yacy/peers/RemoteSearch.java b/source/net/yacy/peers/RemoteSearch.java
index 0aab7bf86..9d005d5ef 100644
--- a/source/net/yacy/peers/RemoteSearch.java
+++ b/source/net/yacy/peers/RemoteSearch.java
@@ -166,6 +166,10 @@ public class RemoteSearch extends Thread {
}
// start solr searches
+ if (Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.DEBUG_SEARCH_REMOTE_SOLR_TESTLOCAL, false)) {
+ nodePeers.clear();
+ nodePeers.add(event.peers.mySeed());
+ }
if (!Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.DEBUG_SEARCH_REMOTE_SOLR_OFF, false)) {
for (Seed s: nodePeers) {
solrRemoteSearch(event, start, count, s, blacklist);
diff --git a/source/net/yacy/search/SwitchboardConstants.java b/source/net/yacy/search/SwitchboardConstants.java
index ad43dec6b..1a742bd7d 100644
--- a/source/net/yacy/search/SwitchboardConstants.java
+++ b/source/net/yacy/search/SwitchboardConstants.java
@@ -328,7 +328,7 @@ public final class SwitchboardConstants {
/**
* debug flags
*/
- public static final String DEBUG_SEARCH_LOCAL_DHT_ON = "debug.search.local.dht.on"; // =true: use the local dht/rwi index (which is not done if we do remote searches)
+ public static final String DEBUG_SEARCH_LOCAL_DHT_OFF = "debug.search.local.dht.off"; // =true: do not use the local dht/rwi index (which is not done if we do remote searches)
public static final String DEBUG_SEARCH_LOCAL_SOLR_OFF = "debug.search.local.solr.off"; // =true: do not use solr
public static final String DEBUG_SEARCH_REMOTE_DHT_OFF = "debug.search.remote.dht.off"; // =true: do not use dht/rwi
public static final String DEBUG_SEARCH_REMOTE_DHT_TESTLOCAL= "debug.search.remote.dht.testlocal"; // =true: do not use dht, search local peer in a shortcut to the own server
diff --git a/source/net/yacy/search/index/Segment.java b/source/net/yacy/search/index/Segment.java
index 5817dc0a9..c951e973e 100644
--- a/source/net/yacy/search/index/Segment.java
+++ b/source/net/yacy/search/index/Segment.java
@@ -563,7 +563,7 @@ public class Segment {
try {
container = ReferenceContainer.emptyContainer(Segment.wordReferenceFactory, wordhash, 1);
container.add(ientry);
- searchEvent.addRWIs(container, true, sourceName, -1, 5000);
+ searchEvent.addRWIs(container, true, sourceName, 1, 5000);
} catch (final SpaceExceededException e) {
continue;
}
diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.java
index ba8afd368..53603b326 100644
--- a/source/net/yacy/search/query/SearchEvent.java
+++ b/source/net/yacy/search/query/SearchEvent.java
@@ -264,10 +264,9 @@ public final class SearchEvent {
// start a local RWI search concurrently
this.rwiProcess = null;
- if (query.getSegment().connectedRWI() && (
- !this.remote ||
- this.peers.mySeed().getBirthdate() < noRobinsonLocalRWISearch) ||
- Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.DEBUG_SEARCH_LOCAL_DHT_ON, false)) {
+ if (query.getSegment().connectedRWI() &&
+ //(!this.remote || this.peers.mySeed().getBirthdate() < noRobinsonLocalRWISearch) &&
+ !Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.DEBUG_SEARCH_LOCAL_DHT_OFF, false)) {
// we start the local search only if this peer is doing a remote search or when it is doing a local search and the peer is old
rwiProcess = new RWIProcess();
rwiProcess.start();
@@ -428,7 +427,7 @@ public final class SearchEvent {
System.currentTimeMillis() - timer),
false);
if ( !index.isEmpty() ) {
- addRWIs(index, true, "local index: " + SearchEvent.this.query.getSegment().getLocation(), -1, SearchEvent.this.maxtime);
+ addRWIs(index, true, "local index: " + SearchEvent.this.query.getSegment().getLocation(), index.size(), SearchEvent.this.maxtime);
SearchEvent.this.addFinalize();
}
} catch ( final Exception e ) {
@@ -453,6 +452,7 @@ public final class SearchEvent {
assert (index != null);
if (index.isEmpty()) return;
if (local) {
+ assert fullResource >= 0 : "fullResource = " + fullResource;
this.local_rwi_stored.addAndGet(fullResource);
} else {
assert fullResource >= 0 : "fullResource = " + fullResource;
@@ -1280,12 +1280,12 @@ public final class SearchEvent {
EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.EventSearch(this.query.id(true), SearchEventType.ONERESULT, "started, item = " + item + ", available = " + this.getResultCount(), 0, 0), false);
// wait until a local solr is finished, we must do that to be able to check if we need more
- if (this.localsolrsearch.isAlive()) {try {this.localsolrsearch.join(100);} catch (InterruptedException e) {}}
+ if (this.localsolrsearch != null && this.localsolrsearch.isAlive()) {try {this.localsolrsearch.join(100);} catch (InterruptedException e) {}}
if (item >= this.localsolroffset && this.local_solr_stored.get() == 0 && this.localsolrsearch.isAlive()) {try {this.localsolrsearch.join();} catch (InterruptedException e) {}}
if (item >= this.localsolroffset && this.local_solr_stored.get() >= item) {
// load remaining solr results now
int nextitems = item - this.localsolroffset + this.query.itemsPerPage; // example: suddenly switch to item 60, just 10 had been shown, 20 loaded.
- if (this.localsolrsearch.isAlive()) {try {this.localsolrsearch.join();} catch (InterruptedException e) {}}
+ if (this.localsolrsearch != null && this.localsolrsearch.isAlive()) {try {this.localsolrsearch.join();} catch (InterruptedException e) {}}
if (!Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.DEBUG_SEARCH_LOCAL_SOLR_OFF, false)) {
this.localsolrsearch = RemoteSearch.solrRemoteSearch(this, this.localsolroffset, nextitems, null /*this peer*/, Switchboard.urlBlacklist);
}
@@ -1305,7 +1305,7 @@ public final class SearchEvent {
final ResultEntry re = this.resultList.element(item).getElement();
EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.EventSearch(this.query.id(true), SearchEventType.ONERESULT, "fetched, item = " + item + ", available = " + this.getResultCount() + ": " + re.urlstring(), 0, 0), false);
- if (!this.localsolrsearch.isAlive() && this.local_solr_stored.get() > this.localsolroffset && (item + 1) % this.query.itemsPerPage == 0) {
+ if (this.localsolrsearch == null || !this.localsolrsearch.isAlive() && this.local_solr_stored.get() > this.localsolroffset && (item + 1) % this.query.itemsPerPage == 0) {
// at the end of a list, trigger a next solr search
if (!Switchboard.getSwitchboard().getConfigBool(SwitchboardConstants.DEBUG_SEARCH_LOCAL_SOLR_OFF, false)) {
this.localsolrsearch = RemoteSearch.solrRemoteSearch(this, this.localsolroffset, this.query.itemsPerPage, null /*this peer*/, Switchboard.urlBlacklist);