From 1f94df29e75b59d4204b71e58fafd97f102b82e8 Mon Sep 17 00:00:00 2001 From: reger Date: Tue, 1 Jul 2014 23:24:26 +0200 Subject: [PATCH] fix NPE in solr rss where snippet contains only the title text and adjusted xslt, for solr snippets (&hl=true) to decode the xml encoded html tag by adding disable-output-escaping (still open item description may be double as dc: tag and rss.description tag) --- htroot/yacysearch.xsl | 2 +- pom.xml | 2 +- .../solr/responsewriter/OpensearchResponseWriter.java | 10 ++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/htroot/yacysearch.xsl b/htroot/yacysearch.xsl index 5e5d1a7fd..9bcb7e7e3 100644 --- a/htroot/yacysearch.xsl +++ b/htroot/yacysearch.xsl @@ -28,7 +28,7 @@

-

+

diff --git a/pom.xml b/pom.xml index be679f978..16f2327c2 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ 1.7 1.7 - 4.8.1 + 4.9.0 ${DSTAMP} diff --git a/source/net/yacy/cora/federate/solr/responsewriter/OpensearchResponseWriter.java b/source/net/yacy/cora/federate/solr/responsewriter/OpensearchResponseWriter.java index 45b32d70f..07f8c936d 100644 --- a/source/net/yacy/cora/federate/solr/responsewriter/OpensearchResponseWriter.java +++ b/source/net/yacy/cora/federate/solr/responsewriter/OpensearchResponseWriter.java @@ -239,16 +239,14 @@ public class OpensearchResponseWriter implements QueryResponseWriter { LinkedHashSet snippet = urlhash == null ? null : snippets.get(urlhash); String tagname = RSSMessage.Token.description.name(); if (snippet == null || snippet.size() == 0) { + writer.write("<"); writer.write(tagname); writer.write('>'); for (String d: descriptions) { - writer.write("<"); writer.write(tagname); writer.write('>'); XML.escapeCharData(d, writer); - writer.write("\n"); } - } else { - OpensearchResponseWriter.removeSubsumedTitle(snippet, title); - writer.write("<"); writer.write(tagname); writer.write('>'); - XML.escapeCharData(OpensearchResponseWriter.getLargestSnippet(snippet), writer); writer.write("\n"); + } else { + removeSubsumedTitle(snippet, title); + solitaireTag(writer, tagname, getLargestSnippet(snippet)); // snippet may be size=0 } // open: where do we get the subject? //solitaireTag(writer, DublinCore.Subject.getURIref(), ""); // TODO: fill with actual data