diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java index 407289a21..0668795ef 100644 --- a/htroot/yacysearchitem.java +++ b/htroot/yacysearchitem.java @@ -208,7 +208,7 @@ public class yacysearchitem { prop.put("content_showVocabulary", sb.getConfigBool("search.result.show.vocabulary", true) ? 1 : 0); if (showEvent) prop.put("content_showEvent_date", GenericFormatter.RFC1123_SHORT_FORMATTER.format(events[0])); - prop.put("content_showDate_date", GenericFormatter.RFC1123_SHORT_FORMATTER.format(result.modified())); + prop.put("content_showDate_date", GenericFormatter.RFC1123_SHORT_FORMATTER.format(result.moddate())); prop.putHTML("content_showSize_sizename", RSSMessage.sizename(result.filesize())); prop.put("content_showMetadata_urlhash", urlhash); prop.put("content_showParser_urlhash", urlhash); @@ -218,7 +218,7 @@ public class yacysearchitem { prop.put("content_showProxy_link", resultUrlstring); prop.put("content_showHostBrowser_link", resultUrlstring); if (sb.getConfigBool("search.result.show.vocabulary", true)) { - URIMetadataNode node = result.getNode(); + URIMetadataNode node = result; int c = 0; for (Map.Entry entry: node.entrySet()) { String key = entry.getKey(); @@ -239,7 +239,7 @@ public class yacysearchitem { } prop.put("content_urlhexhash", Seed.b64Hash2hexHash(urlhash)); prop.putHTML("content_urlname", nxTools.shortenURLString(result.urlname(), MAX_URL_LENGTH)); - prop.put("content_date822", isAtomFeed ? ISO8601Formatter.FORMATTER.format(result.modified()) : HeaderFramework.formatRFC1123(result.modified())); + prop.put("content_date822", isAtomFeed ? ISO8601Formatter.FORMATTER.format(result.moddate()) : HeaderFramework.formatRFC1123(result.moddate())); if (showEvent) prop.put("content_showEvent_date822", isAtomFeed ? ISO8601Formatter.FORMATTER.format(events[0]) : HeaderFramework.formatRFC1123(events[0])); //prop.put("content_ybr", RankingProcess.ybr(result.hash())); prop.putHTML("content_size", Integer.toString(result.filesize())); // we don't use putNUM here because that number shall be usable as sorting key. To print the size, use 'sizename' @@ -248,9 +248,9 @@ public class yacysearchitem { prop.putXML("content_file", resultFileName); // putXML for rss prop.putXML("content_path", resultURL.getPath()); // putXML for rss prop.put("content_nl", (item == theSearch.query.offset) ? 0 : 1); - prop.putHTML("content_publisher", result.publisher()); - prop.putHTML("content_creator", result.creator());// author - prop.putHTML("content_subject", result.subject()); + prop.putHTML("content_publisher", result.dc_publisher()); + prop.putHTML("content_creator", result.dc_creator());// author + prop.putHTML("content_subject", result.dc_subject()); final Iterator query = theSearch.query.getQueryGoal().getIncludeStrings(); final StringBuilder s = new StringBuilder(theSearch.query.getQueryGoal().getIncludeSize() * 20); while (query.hasNext()) s.append('+').append(query.next()); @@ -263,7 +263,7 @@ public class yacysearchitem { prop.put("content_description", desc); prop.putXML("content_description-xml", desc); prop.putJSON("content_description-json", desc); - prop.put("content_mimetype",result.getNode().mime()); // for atom type attribute + prop.put("content_mimetype", result.mime()); // for atom type attribute final HeuristicResult heuristic = theSearch.getHeuristic(result.hash()); if (heuristic == null) { prop.put("content_heuristic", 0); diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.java index 2d426eaed..dd896c4c0 100644 --- a/source/net/yacy/search/query/SearchEvent.java +++ b/source/net/yacy/search/query/SearchEvent.java @@ -1570,25 +1570,22 @@ public final class SearchEvent { public ImageResult oneImageResult(final int item, final long timeout) throws MalformedURLException { if (item < imageViewed.size()) return nthImage(item); if (imageSpareGood.size() > 0) return nextSpare(); // first put out all good spare, but no bad spare - ResultEntry ms = oneResult(imagePageCounter++, timeout); // we must use a different counter here because the image counter can be higher when one page filled up several spare + ResultEntry doc = oneResult(imagePageCounter++, timeout); // we must use a different counter here because the image counter can be higher when one page filled up several spare // check if the match was made in the url or in the image links - if (ms == null) { + if (doc == null) { if (hasSpare()) return nextSpare(); throw new MalformedURLException("no image url found"); } // try to get more - SolrDocument doc = ms.getNode(); + // there can be two different kinds of image hits: either the document itself is an image or images are embedded in the links of text documents. String mime = (String) doc.getFirstValue(CollectionSchema.content_type.getSolrFieldName()); // boolean fakeImageHost = ms.url().getHost() != null && ms.url().getHost().indexOf("wikipedia") > 0; // pages with image extension from wikipedia do not contain image files but html files... I know this is a bad hack, but many results come from wikipedia and we must handle that // generalize above hack (regarding url with file extension but beeing a html (with html mime) - char docType = Response.docType(mime); // first look at mime (as some html pages have img extension (like wikipedia) - if (docType == Response.DT_UNKNOWN) docType = Response.docType(ms.url()); // try extension if mime wasn't successful - - if (docType == Response.DT_IMAGE) { - String id = ASCII.String(ms.hash()); - if (!imageViewed.containsKey(id) && !containsSpare(id)) imageSpareGood.put(id, new ImageResult(ms.url(), ms.url(), "", ms.title(), 0, 0, 0)); + if (doc.doctype() == Response.DT_IMAGE) { + String id = ASCII.String(doc.hash()); + if (!imageViewed.containsKey(id) && !containsSpare(id)) imageSpareGood.put(id, new ImageResult(doc.url(), doc.url(), "", doc.title(), 0, 0, 0)); } else { Collection altO = doc.getFieldValues(CollectionSchema.images_alt_sxt.getSolrFieldName()); Collection imgO = doc.getFieldValues(CollectionSchema.images_urlstub_sxt.getSolrFieldName()); @@ -1612,7 +1609,7 @@ public final class SearchEvent { boolean sizeok = h != null && w != null && h.intValue() > 16 && w.intValue() > 16; String id = ASCII.String(imageUrl.hash()); if (!imageViewed.containsKey(id) && !containsSpare(id)) { - ImageResult imageResult = new ImageResult(ms.url(), imageUrl, "", image_alt, w == null ? 0 : w, h == null ? 0 : h, 0); + ImageResult imageResult = new ImageResult(doc.url(), imageUrl, "", image_alt, w == null ? 0 : w, h == null ? 0 : h, 0); if (match || sizeok) imageSpareGood.put(id, imageResult); else imageSpareBad.put(id, imageResult); } } catch (MalformedURLException e) { diff --git a/source/net/yacy/search/snippet/ResultEntry.java b/source/net/yacy/search/snippet/ResultEntry.java index e9f91d544..6d4364088 100644 --- a/source/net/yacy/search/snippet/ResultEntry.java +++ b/source/net/yacy/search/snippet/ResultEntry.java @@ -30,7 +30,6 @@ import java.io.IOException; import java.util.Comparator; import java.util.Date; -import net.yacy.cora.document.id.DigestURL; import net.yacy.cora.document.id.MultiProtocolURL; import net.yacy.cora.order.Base64Order; import net.yacy.cora.util.ByteArray; @@ -39,21 +38,15 @@ import net.yacy.document.Condenser; import net.yacy.document.parser.pdfParser; import net.yacy.kelondro.data.meta.URIMetadataNode; import net.yacy.kelondro.data.word.Word; -import net.yacy.kelondro.data.word.WordReference; -import net.yacy.kelondro.data.word.WordReferenceRow; -import net.yacy.kelondro.data.word.WordReferenceVars; -import net.yacy.kelondro.rwi.Reference; -import net.yacy.kelondro.util.Bitfield; import net.yacy.peers.Seed; import net.yacy.peers.SeedDB; import net.yacy.search.index.Segment; import net.yacy.search.schema.CollectionSchema; -public class ResultEntry implements Comparable, Comparator { +public class ResultEntry extends URIMetadataNode implements Comparable, Comparator { // payload objects - private final URIMetadataNode urlentry; private String alternative_urlstring; private String alternative_urlname; private final TextSnippet textSnippet; @@ -63,8 +56,8 @@ public class ResultEntry implements Comparable, Comparator, Comparator, Comparator