Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fix for image size field values (must be multi-valued)
Michael Peter Christen151ccd50a98d
diff --git a/source/net/yacy/search/schema/CollectionConfiguration.java b/source/net/yacy/search/schema/CollectionConfiguration.javaindex b9617d1f9..f98d49c78 100644--- a/source/net/yacy/search/schema/CollectionConfiguration.java+++ b/source/net/yacy/search/schema/CollectionConfiguration.java@@ -917,15 +917,23 @@ public class CollectionConfiguration extends SchemaConfiguration implements Seriif (document.getContentDomain() == ContentDomain.IMAGE) {// add image pixel size if knownIterator<ImageEntry> imgit = document.getImages().values().iterator();- if (imgit.hasNext()) {+ List<Integer> heights = new ArrayList<>();+ List<Integer> widths = new ArrayList<>();+ List<Integer> pixels = new ArrayList<>();+ while (imgit.hasNext()) {ImageEntry img = imgit.next();int imgpixels = (img.height() < 0 || img.width() < 0) ? -1 : img.height() * img.width();- if (imgpixels > 0) {- if (allAttr || contains(CollectionSchema.images_height_val)) add(doc, CollectionSchema.images_height_val, img.height());- if (allAttr || contains(CollectionSchema.images_width_val)) add(doc, CollectionSchema.images_width_val, img.width());- if (allAttr || contains(CollectionSchema.images_pixel_val)) add(doc, CollectionSchema.images_pixel_val, imgpixels);+ if (imgpixels > 0 && (allAttr || (contains(CollectionSchema.images_height_val) && contains(CollectionSchema.images_width_val) && contains(CollectionSchema.images_pixel_val)))) {+ heights.add(img.height());+ widths.add(img.width());+ pixels.add(imgpixels);}}+ if (heights.size() > 0) {+ add(doc, CollectionSchema.images_height_val, heights);+ add(doc, CollectionSchema.images_width_val, widths);+ add(doc, CollectionSchema.images_pixel_val, pixels);+ }if (allAttr || contains(CollectionSchema.images_text_t)) {add(doc, CollectionSchema.images_text_t, content); // the content may contain the exif data from the image parser