Skip to content

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

bugfix: lookup of peernames no result for active peer in page IndexControlRWIs_p.html -> Transfer RWI to other Peer SeedDB.lookupByName searche for lowercase peerNames, while MapColumnIndex.getIndex uses peername as is in the keyset. Changed the index init to insert lowercase peer names as key

reger6696cb131351
diff --git a/htroot/IndexControlRWIs_p.html b/htroot/IndexControlRWIs_p.html
index 617db8ecc..c9e50d939 100644
--- a/htroot/IndexControlRWIs_p.html
+++ b/htroot/IndexControlRWIs_p.html
@@ -166,10 +166,11 @@
</dd>
<dt class="TableCellDark">to Peer:</dt>
<dd>select <select name="hostHash">
- #{hosts}#
- <option value="#[hosthash]#">#[hostname]#</option>
- #{/hosts}#
- </select> or enter a hash:<input type="text" name="host" value="" size="21" maxlength="21" />
+ #{hosts}#
+ <option value="#[hosthash]#">#[hostname]#</option>
+ #{/hosts}#
+ </select> <br>
+ or enter a hash or peer name:<input type="text" name="host" value="" size="21" maxlength="21" />
</dd>
</dl>
</fieldset>
diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.java
index 2a2e406d6..559ea0175 100644
--- a/htroot/IndexControlRWIs_p.java
+++ b/htroot/IndexControlRWIs_p.java
@@ -306,8 +306,9 @@ public class IndexControlRWIs_p
Seed seed = null;
if ( host.length() != 0 ) {
if ( host.length() == 12 ) {
- // the host string is a peer hash
- seed = sb.peers.getConnected(host);
+ // the host string is !likely! a peer hash (or peer name with 12 chars)
+ seed = sb.peers.getConnected(host); // check for seed.hash
+ if (seed == null) seed = sb.peers.lookupByName(host); // check for peer name
} else {
// the host string can be a host name
seed = sb.peers.lookupByName(host);
@@ -317,59 +318,63 @@ public class IndexControlRWIs_p
seed = sb.peers.getConnected(host);
}
- // prepare index
- ReferenceContainer<WordReference> index;
- final long starttime = System.currentTimeMillis();
- index = segment.termIndex().get(keyhash, null);
- // built urlCache
- final Iterator<WordReference> urlIter = index.entries();
- final TreeMap<byte[], URIMetadataRow> knownURLs =
- new TreeMap<byte[], URIMetadataRow>(Base64Order.enhancedCoder);
- final HandleSet unknownURLEntries =
- new HandleSet(
- WordReferenceRow.urlEntryRow.primaryKeyLength,
- WordReferenceRow.urlEntryRow.objectOrder,
- index.size());
- Reference iEntry;
- URIMetadataRow lurl;
- while ( urlIter.hasNext() ) {
- iEntry = urlIter.next();
- lurl = segment.urlMetadata().load(iEntry.urlhash());
- if ( lurl == null ) {
- try {
- unknownURLEntries.put(iEntry.urlhash());
- } catch ( final RowSpaceExceededException e ) {
- Log.logException(e);
+ if (seed != null) { // if no seed found skip transfer
+ // prepare index
+ ReferenceContainer<WordReference> index;
+ final long starttime = System.currentTimeMillis();
+ index = segment.termIndex().get(keyhash, null);
+ // built urlCache
+ final Iterator<WordReference> urlIter = index.entries();
+ final TreeMap<byte[], URIMetadataRow> knownURLs =
+ new TreeMap<byte[], URIMetadataRow>(Base64Order.enhancedCoder);
+ final HandleSet unknownURLEntries =
+ new HandleSet(
+ WordReferenceRow.urlEntryRow.primaryKeyLength,
+ WordReferenceRow.urlEntryRow.objectOrder,
+ index.size());
+ Reference iEntry;
+ URIMetadataRow lurl;
+ while (urlIter.hasNext()) {
+ iEntry = urlIter.next();
+ lurl = segment.urlMetadata().load(iEntry.urlhash());
+ if (lurl == null) {
+ try {
+ unknownURLEntries.put(iEntry.urlhash());
+ } catch (final RowSpaceExceededException e) {
+ Log.logException(e);
+ }
+ urlIter.remove();
+ } else {
+ knownURLs.put(iEntry.urlhash(), lurl);
}
- urlIter.remove();
- } else {
- knownURLs.put(iEntry.urlhash(), lurl);
}
- }
- // make an indexContainerCache
- final ReferenceContainerCache<WordReference> icc =
- new ReferenceContainerCache<WordReference>(
- Segment.wordReferenceFactory,
- Segment.wordOrder,
- Word.commonHashLength);
- try {
- icc.add(index);
- } catch ( final RowSpaceExceededException e ) {
- Log.logException(e);
- }
+ // make an indexContainerCache
+ final ReferenceContainerCache<WordReference> icc =
+ new ReferenceContainerCache<WordReference>(
+ Segment.wordReferenceFactory,
+ Segment.wordOrder,
+ Word.commonHashLength);
+ try {
+ icc.add(index);
+ } catch (final RowSpaceExceededException e) {
+ Log.logException(e);
+ }
- // transport to other peer
- final boolean gzipBody = sb.getConfigBool("indexControl.gzipBody", false);
- final int timeout = (int) sb.getConfigLong("indexControl.timeout", 60000);
- final String error = Protocol.transferIndex(seed, icc, knownURLs, gzipBody, timeout);
- prop.put("result", (error == null) ? ("Successfully transferred "
- + knownURLs.size()
- + " words in "
- + ((System.currentTimeMillis() - starttime) / 1000)
- + " seconds, "
- + unknownURLEntries.size() + " URL not found") : "error: " + error);
- index = null;
+ // transport to other peer
+ final boolean gzipBody = sb.getConfigBool("indexControl.gzipBody", false);
+ final int timeout = (int) sb.getConfigLong("indexControl.timeout", 60000);
+ final String error = Protocol.transferIndex(seed, icc, knownURLs, gzipBody, timeout);
+ prop.put("result", (error == null) ? ("Successfully transferred "
+ + knownURLs.size()
+ + " words in "
+ + ((System.currentTimeMillis() - starttime) / 1000)
+ + " seconds, "
+ + unknownURLEntries.size() + " URL not found") : "error: " + error);
+ index = null;
+ } else {
+ prop.put("result", "Peer " + host + " not found");
+ }
} catch ( final IOException e ) {
Log.logException(e);
}
diff --git a/source/net/yacy/kelondro/blob/MapColumnIndex.java b/source/net/yacy/kelondro/blob/MapColumnIndex.java
index fc7a9dcb2..34ed4ab93 100644
--- a/source/net/yacy/kelondro/blob/MapColumnIndex.java
+++ b/source/net/yacy/kelondro/blob/MapColumnIndex.java
@@ -74,7 +74,7 @@ public class MapColumnIndex {
line = table.next();
String value = line.getValue().get(whereKey);
if (value == null) continue; // we don't need to remember that
- indexupdate(line.getKey(), valueIdxMap, value);
+ indexupdate(line.getKey(), valueIdxMap, value.toLowerCase()); // add the entry lowercase (needed for seedDB.lookupByName)
}
}