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()) {
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;

@ -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));
}
}
}

@ -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);
}

Loading…
Cancel
Save