From e0b3984805b708a96357bf492beccc9be9a532f2 Mon Sep 17 00:00:00 2001 From: orbiter Date: Tue, 9 Jun 2009 09:07:52 +0000 Subject: [PATCH] added navigation keys for site and author facets to remote search interface git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6038 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/yacy/search.java | 2 +- .../de/anomic/plasma/plasmaSearchEvent.java | 4 +++- source/de/anomic/yacy/yacyClient.java | 4 ++++ source/de/anomic/yacy/yacySearch.java | 20 +++++++++++++++---- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java index a755ca8d8..4d36a065c 100644 --- a/htroot/yacy/search.java +++ b/htroot/yacy/search.java @@ -92,7 +92,7 @@ public final class search { String sitehash = post.get("sitehash", ""); if (sitehash.length() == 0) sitehash = null; String authorhash = post.get("authorhash", ""); if (authorhash.length() == 0) authorhash = null; String language = post.get("language", ""); - if (!iso639.exists(language)) { + if (language == null || language.length() == 0 || !iso639.exists(language)) { // take language from the user agent String agent = header.get("User-Agent"); if (agent == null) agent = System.getProperty("user.language"); diff --git a/source/de/anomic/plasma/plasmaSearchEvent.java b/source/de/anomic/plasma/plasmaSearchEvent.java index b4c22ad1a..ff992426e 100644 --- a/source/de/anomic/plasma/plasmaSearchEvent.java +++ b/source/de/anomic/plasma/plasmaSearchEvent.java @@ -157,7 +157,9 @@ public final class plasmaSearchEvent { "", query.prefer, query.urlMask, - query.targetlang, + query.targetlang == null ? "" : query.targetlang, + query.sitehash == null ? "" : query.sitehash, + query.authorhash == null ? "" : query.authorhash, query.displayResults(), query.maxDistance, indexSegment, diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java index 4cbbcabb6..cea74465b 100644 --- a/source/de/anomic/yacy/yacyClient.java +++ b/source/de/anomic/yacy/yacyClient.java @@ -426,6 +426,8 @@ public final class yacyClient { final String prefer, final String filter, final String language, + final String sitehash, + final String authorhash, final int count, final int maxDistance, final boolean global, @@ -469,6 +471,8 @@ public final class yacyClient { post.add(new DefaultCharsetStringPart("prefer", prefer)); post.add(new DefaultCharsetStringPart("filter", filter)); post.add(new DefaultCharsetStringPart("language", language)); + post.add(new DefaultCharsetStringPart("sitehash", sitehash)); + post.add(new DefaultCharsetStringPart("authorhash", authorhash)); post.add(new DefaultCharsetStringPart("ttl", "0")); post.add(new DefaultCharsetStringPart("maxdist", Integer.toString(maxDistance))); post.add(new DefaultCharsetStringPart("profile", crypt.simpleEncode(rankingProfile.toExternalString()))); diff --git a/source/de/anomic/yacy/yacySearch.java b/source/de/anomic/yacy/yacySearch.java index 9425a11c9..91c01a3c4 100644 --- a/source/de/anomic/yacy/yacySearch.java +++ b/source/de/anomic/yacy/yacySearch.java @@ -44,7 +44,7 @@ import de.anomic.yacy.dht.PeerSelection; public class yacySearch extends Thread { - final private String wordhashes, excludehashes, urlhashes; + final private String wordhashes, excludehashes, urlhashes, sitehash, authorhash; final private boolean global; final private int partitions; final private Segment indexSegment; @@ -65,6 +65,8 @@ public class yacySearch extends Thread { final String wordhashes, final String excludehashes, final String urlhashes, final String prefer, final String filter, final String language, + final String sitehash, + final String authorhash, final int count, final int maxDistance, final boolean global, final int partitions, final yacySeed targetPeer, @@ -85,6 +87,8 @@ public class yacySearch extends Thread { this.prefer = prefer; this.filter = filter; this.language = language; + this.sitehash = sitehash; + this.authorhash = authorhash; this.global = global; this.partitions = partitions; this.indexSegment = indexSegment; @@ -105,7 +109,9 @@ public class yacySearch extends Thread { try { this.urls = yacyClient.search( peers.mySeed(), - wordhashes, excludehashes, urlhashes, prefer, filter, language, count, maxDistance, global, partitions, + wordhashes, excludehashes, urlhashes, prefer, filter, language, + sitehash, authorhash, + count, maxDistance, global, partitions, targetPeer, indexSegment, crawlResults, containerCache, abstractCache, blacklist, rankingProfile, constraint); if (urls != null) { @@ -241,6 +247,8 @@ public class yacySearch extends Thread { public static yacySearch[] primaryRemoteSearches( final String wordhashes, final String excludehashes, final String urlhashes, final String prefer, final String filter, String language, + final String sitehash, + final String authorhash, final int count, final int maxDist, final Segment indexSegment, final yacySeedDB peers, @@ -272,7 +280,10 @@ public class yacySearch extends Thread { final yacySearch[] searchThreads = new yacySearch[targets]; for (int i = 0; i < targets; i++) { if (targetPeers[i] == null || targetPeers[i].hash == null) continue; - searchThreads[i] = new yacySearch(wordhashes, excludehashes, urlhashes, prefer, filter, language, count, maxDist, true, targets, targetPeers[i], + searchThreads[i] = new yacySearch( + wordhashes, excludehashes, urlhashes, prefer, filter, language, + sitehash, authorhash, + count, maxDist, true, targets, targetPeers[i], indexSegment, peers, crawlResults, containerCache, abstractCache, blacklist, rankingProfile, constraint); searchThreads[i].start(); //try {Thread.sleep(20);} catch (InterruptedException e) {} @@ -298,7 +309,8 @@ public class yacySearch extends Thread { final yacySeed targetPeer = peers.getConnected(targethash); if (targetPeer == null || targetPeer.hash == null) return null; if (clusterselection != null) targetPeer.setAlternativeAddress(clusterselection.get(targetPeer.hash.getBytes())); - final yacySearch searchThread = new yacySearch(wordhashes, excludehashes, urlhashes, "", "", "en", 0, 9999, true, 0, targetPeer, + final yacySearch searchThread = new yacySearch( + wordhashes, excludehashes, urlhashes, "", "", "", "", "", 0, 9999, true, 0, targetPeer, indexSegment, peers, crawlResults, containerCache, new TreeMap>(), blacklist, rankingProfile, constraint); searchThread.start(); return searchThread;