Skip to content

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

more enhancements to image search

orbiter06d0dcde20b1
diff --git a/source/de/anomic/search/MediaSnippet.java b/source/de/anomic/search/MediaSnippet.java
index 4d278bda8..f7d9a801d 100644
--- a/source/de/anomic/search/MediaSnippet.java
+++ b/source/de/anomic/search/MediaSnippet.java
@@ -123,6 +123,10 @@ public class MediaSnippet {
while (i.hasNext()) {
ientry = i.next();
url = ientry.url();
+ String u = url.toString();
+ if (u.indexOf(".ico") >= 0 || u.indexOf("favicon") >= 0) continue;
+ if (ientry.height() > 0 && ientry.height() < 64) continue;
+ if (ientry.width() > 0 && ientry.width() < 64) continue;
desc = ientry.alt();
int appcount = 0;
s = TextSnippet.removeAppearanceHashes(url.toNormalform(false, false), queryhashes);
@@ -131,7 +135,7 @@ public class MediaSnippet {
s = TextSnippet.removeAppearanceHashes(desc, s);
appcount += queryhashes.size() - s.size();
// if the resulting set is empty, then _all_ search words appeared in the description
- final int ranking = (ientry.hashCode() / queryhashes.size() / 2) * appcount;
+ final int ranking = /*(ientry.hashCode() / queryhashes.size() / 2) */ ientry.height() * ientry.width() * appcount * 10000 /* 0x7FFF0000)*/;
result.add(new MediaSnippet(ContentDomain.IMAGE, url, desc, ientry.width() + " x " + ientry.height(), ranking, document.dc_source()));
}
return result;
diff --git a/source/de/anomic/search/ResultFetcher.java b/source/de/anomic/search/ResultFetcher.java
index 55159f946..c4a23893d 100644
--- a/source/de/anomic/search/ResultFetcher.java
+++ b/source/de/anomic/search/ResultFetcher.java
@@ -332,20 +332,16 @@ public class ResultFetcher {
return this.images.element(item).element;
}
- // feed some results from the result stack into the image stack
- final int count = Math.min(5, Math.max(1, 10 * this.result.size() / (item + 1)));
- for (int i = 0; i < count; i++) {
- // generate result object
- final ResultEntry result = nextResult();
- MediaSnippet ms;
- if (result != null) {
- // iterate over all images in the result
- final ArrayList<MediaSnippet> imagemedia = result.mediaSnippets();
- if (imagemedia != null) {
- for (int j = 0; j < imagemedia.size(); j++) {
- ms = imagemedia.get(j);
- images.push(ms, Long.valueOf(ms.ranking));
- }
+ // generate result object
+ final ResultEntry result = nextResult();
+ MediaSnippet ms;
+ if (result != null) {
+ // iterate over all images in the result
+ final ArrayList<MediaSnippet> imagemedia = result.mediaSnippets();
+ if (imagemedia != null) {
+ for (int j = 0; j < imagemedia.size(); j++) {
+ ms = imagemedia.get(j);
+ images.push(ms, Long.valueOf(ms.ranking));
}
}
}
diff --git a/source/net/yacy/document/parser/html/ImageEntry.java b/source/net/yacy/document/parser/html/ImageEntry.java
index b7bf1cc20..8db0cf421 100644
--- a/source/net/yacy/document/parser/html/ImageEntry.java
+++ b/source/net/yacy/document/parser/html/ImageEntry.java
@@ -67,7 +67,7 @@ public class ImageEntry implements Comparable<ImageEntry> {
// unfortunately it can not be ensured that all images get different hashes, but this should appear
// only in very rare cases
if (width < 0 || height < 0)
- return 0x7FFF0000 | (url.hashCode() & 0xFFFF);
+ return /*0x7FFF0000 |*/ (url.hashCode() & 0xFFFF);
return ((0x7FFF - (((width * height) >> 9) & 0x7FFF)) << 16) | (url.hashCode() & 0xFFFF);
}