Skip to content

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

- tested successfully z-presentation of yacy seed encoding - added alternative switch that takes shortest representation as yacy seed string encoding

orbiter36b898ca7adc
diff --git a/source/de/anomic/tools/crypt.java b/source/de/anomic/tools/crypt.java
index 4ae4be66b..2c201583c 100644
--- a/source/de/anomic/tools/crypt.java
+++ b/source/de/anomic/tools/crypt.java
@@ -129,4 +129,10 @@ public class crypt {
}
}
+ public static void main(String[] args) {
+ String teststring="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ System.out.println("Teststring = " + teststring);
+ System.out.println("enc-b result = " + simpleDecode(simpleEncode(teststring, null, 'b'), null));
+ System.out.println("enc-z result = " + simpleDecode(simpleEncode(teststring, null, 'z'), null));
+ }
}
\ No newline at end of file
diff --git a/source/de/anomic/yacy/yacySeed.java b/source/de/anomic/yacy/yacySeed.java
index 99c23051b..b34731bdc 100644
--- a/source/de/anomic/yacy/yacySeed.java
+++ b/source/de/anomic/yacy/yacySeed.java
@@ -818,7 +818,11 @@ public class yacySeed {
public final String genSeedStr(String key) {
// use a default encoding
- return this.genSeedStr('z', key);
+ String z = this.genSeedStr('z', key);
+ String b = this.genSeedStr('b', key);
+ // the compressed string may be longer that the uncompressed if there is too much overhead for compression meta-info
+ // take simply that string that is shorter
+ if (b.length() < z.length()) return b; else return z;
}
public final synchronized String genSeedStr(char method, String key) {