more enhancements to image search

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6490 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 4c6312d103
commit 06d0dcde20

@ -123,6 +123,10 @@ public class MediaSnippet {
while (i.hasNext()) { while (i.hasNext()) {
ientry = i.next(); ientry = i.next();
url = ientry.url(); 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(); desc = ientry.alt();
int appcount = 0; int appcount = 0;
s = TextSnippet.removeAppearanceHashes(url.toNormalform(false, false), queryhashes); s = TextSnippet.removeAppearanceHashes(url.toNormalform(false, false), queryhashes);
@ -131,7 +135,7 @@ public class MediaSnippet {
s = TextSnippet.removeAppearanceHashes(desc, s); s = TextSnippet.removeAppearanceHashes(desc, s);
appcount += queryhashes.size() - s.size(); appcount += queryhashes.size() - s.size();
// if the resulting set is empty, then _all_ search words appeared in the description // 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())); result.add(new MediaSnippet(ContentDomain.IMAGE, url, desc, ientry.width() + " x " + ientry.height(), ranking, document.dc_source()));
} }
return result; return result;

@ -332,9 +332,6 @@ public class ResultFetcher {
return this.images.element(item).element; 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 // generate result object
final ResultEntry result = nextResult(); final ResultEntry result = nextResult();
MediaSnippet ms; MediaSnippet ms;
@ -348,7 +345,6 @@ public class ResultFetcher {
} }
} }
} }
}
// now take the specific item from the image stack // now take the specific item from the image stack
if (this.images.size() <= item) return null; if (this.images.size() <= item) return null;

@ -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 // unfortunately it can not be ensured that all images get different hashes, but this should appear
// only in very rare cases // only in very rare cases
if (width < 0 || height < 0) 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); return ((0x7FFF - (((width * height) >> 9) & 0x7FFF)) << 16) | (url.hashCode() & 0xFFFF);
} }

Loading…
Cancel
Save