From cc208702670e7c55ec04ac7a6f7acb9392099dea Mon Sep 17 00:00:00 2001 From: orbiter Date: Thu, 29 Nov 2007 21:03:47 +0000 Subject: [PATCH] fix for constraint handover problem: old yacy versions set a catchall-constraint if no constraint is given, but the new versions expect a null-constraint. see http://forum.yacy-websuche.de/viewtopic.php?f=5&t=565&hilit= git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4238 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/yacy/search.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java index d03365985..1b1f87cb1 100644 --- a/htroot/yacy/search.java +++ b/htroot/yacy/search.java @@ -83,7 +83,15 @@ public final class search { String profile = post.get("profile", ""); // remote profile hand-over if (profile.length() > 0) profile = crypt.simpleDecode(profile, null); //final boolean includesnippet = post.get("includesnippet", "false").equals("true"); - final kelondroBitfield constraint = ((post.containsKey("constraint")) && (post.get("constraint", "").length() > 0)) ? new kelondroBitfield(4, post.get("constraint", "______")) : null; + kelondroBitfield constraint = ((post.containsKey("constraint")) && (post.get("constraint", "").length() > 0)) ? new kelondroBitfield(4, post.get("constraint", "______")) : null; + if (constraint != null) { + // check bad handover parameter from older versions + boolean allon = true; + for (int i = 0; i < 32; i++) { + if (!constraint.get(i)) {allon = false; break;} + } + if (allon) constraint = null; + } // final boolean global = ((String) post.get("resource", "global")).equals("global"); // if true, then result may consist of answers from other peers // Date remoteTime = yacyCore.parseUniversalDate((String) post.get(yacySeed.MYTIME)); // read remote time