From 3963bca3b6d00e8ba8d9101d5bdf28415e300d85 Mon Sep 17 00:00:00 2001 From: reger Date: Mon, 4 Aug 2014 00:03:42 +0200 Subject: [PATCH 1/2] catch IndexControlRWIs_p error if RWI not connected --- htroot/IndexControlRWIs_p.java | 55 ++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.java index 6c06e1e8f..8a5d5caf8 100644 --- a/htroot/IndexControlRWIs_p.java +++ b/htroot/IndexControlRWIs_p.java @@ -61,6 +61,7 @@ import net.yacy.peers.Seed; import net.yacy.repository.Blacklist; import net.yacy.repository.Blacklist.BlacklistType; import net.yacy.search.Switchboard; +import net.yacy.search.SwitchboardConstants; import net.yacy.search.index.Segment; import net.yacy.search.query.QueryGoal; import net.yacy.search.query.QueryModifier; @@ -331,34 +332,38 @@ public class IndexControlRWIs_p { } } - // generate list - if ( post.containsKey("keyhashsimilar") ) { - try { - final Iterator> containerIt = - segment.termIndex().referenceContainer(keyhash, true, false, 256, false).iterator(); - ReferenceContainer container; - - int i = 0, rows = 0, cols = 0; - prop.put("keyhashsimilar", "1"); - while ( containerIt.hasNext() && i < 256 ) { - container = containerIt.next(); - prop.put( - "keyhashsimilar_rows_" + rows + "_cols_" + cols + "_wordHash", - container.getTermHash()); - cols++; - if ( cols == 8 ) { - prop.put("keyhashsimilar_rows_" + rows + "_cols", cols); - cols = 0; - rows++; + // generate list (if RWI connected, otherwise NPE) + if (sb.getConfigBool(SwitchboardConstants.CORE_SERVICE_RWI, true)) { + if ( post.containsKey("keyhashsimilar") ) { + try { + final Iterator> containerIt = + segment.termIndex().referenceContainer(keyhash, true, false, 256, false).iterator(); + ReferenceContainer container; + + int i = 0, rows = 0, cols = 0; + prop.put("keyhashsimilar", "1"); + while ( containerIt.hasNext() && i < 256 ) { + container = containerIt.next(); + prop.put( + "keyhashsimilar_rows_" + rows + "_cols_" + cols + "_wordHash", + container.getTermHash()); + cols++; + if ( cols == 8 ) { + prop.put("keyhashsimilar_rows_" + rows + "_cols", cols); + cols = 0; + rows++; + } + i++; } - i++; + prop.put("keyhashsimilar_rows_" + rows + "_cols", cols); + prop.put("keyhashsimilar_rows", rows + 1); + prop.put("result", ""); + } catch (final IOException e ) { + ConcurrentLog.logException(e); } - prop.put("keyhashsimilar_rows_" + rows + "_cols", cols); - prop.put("keyhashsimilar_rows", rows + 1); - prop.put("result", ""); - } catch (final IOException e ) { - ConcurrentLog.logException(e); } + } else { + prop.put("result", "RWI index not connected (see Index Sources & Targets -> Peer-to-Peer Operation)"); } if ( post.containsKey("blacklist") ) { From 8f77719091c6b100abf732e1b828d731ca4698cb Mon Sep 17 00:00:00 2001 From: reger Date: Mon, 4 Aug 2014 02:38:58 +0200 Subject: [PATCH 2/2] fix "Ljava.lang.String" in crawl queue anchor name (e.g. IndexCreateQueues_p.html?stack=LOCAL with images in queue) --- source/net/yacy/document/Document.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/net/yacy/document/Document.java b/source/net/yacy/document/Document.java index a9ced37c6..ed3ec6e5b 100644 --- a/source/net/yacy/document/Document.java +++ b/source/net/yacy/document/Document.java @@ -985,9 +985,11 @@ dc_rights } StringBuilder sb = new StringBuilder(60); sb.append(d.dc_title()); - if (!d.dc_description().equals(d.dc_title()) && sb.length() < Request.descrLength - tagname.length()) { - sb.append(' '); - sb.append(d.dc_description()); + if (d.dc_description().length > 0) { + if (!d.dc_description()[0].equals(d.dc_title()) && sb.length() < Request.descrLength - tagname.length()) { + sb.append(' '); + sb.append(d.dc_description()[0]); + } } if (sb.length() < Request.descrLength - tagname.length()) { sb.append(' ');