Skip to content

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

bugfix for kelondroRow - property generation this bug affected ranking parameters :-(

orbitera2525072f233
diff --git a/source/de/anomic/index/indexURLEntry.java b/source/de/anomic/index/indexURLEntry.java
index 268e7f44e..b4427713a 100644
--- a/source/de/anomic/index/indexURLEntry.java
+++ b/source/de/anomic/index/indexURLEntry.java
@@ -108,6 +108,7 @@ public class indexURLEntry implements Cloneable, indexEntry {
this.entry.setCol(col_worddistance, worddistance);
this.entry.setCol(col_wordcount, wordcount);
this.entry.setCol(col_phrasecount, phrasecount);
+ //System.out.println("DEBUG-NEWENTRY " + toPropertyForm());
}
public indexURLEntry(String urlHash, String code) {
diff --git a/source/de/anomic/kelondro/kelondroRow.java b/source/de/anomic/kelondro/kelondroRow.java
index 1ff0a0f80..91c12c4de 100644
--- a/source/de/anomic/kelondro/kelondroRow.java
+++ b/source/de/anomic/kelondro/kelondroRow.java
@@ -33,6 +33,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
+import de.anomic.server.serverByteBuffer;
+
public class kelondroRow {
protected kelondroColumn[] row;
@@ -369,49 +371,18 @@ public class kelondroRow {
}
public String toPropertyForm(boolean includeBraces, boolean decimalCardinal) {
- StringBuffer sb = new StringBuffer();
- if (includeBraces) sb.append("{");
- int encoder, cellwidth;
+ serverByteBuffer bb = new serverByteBuffer();
+ if (includeBraces) bb.append('{');
for (int i = 0; i < row.length; i++) {
- encoder = row[i].encoder();
- cellwidth = row[i].cellwidth();
- switch (row[i].celltype()) {
- case kelondroColumn.celltype_undefined:
- throw new kelondroException("ROW", "toEncodedForm of celltype undefined not possible");
- case kelondroColumn.celltype_boolean:
- throw new kelondroException("ROW", "toEncodedForm of celltype boolean not yet implemented");
- case kelondroColumn.celltype_binary:
- sb.append(row[i].nickname());
- sb.append('=');
- for (int j = colstart[i]; j < colstart[i] + cellwidth; j++) sb.append((char) rowinstance[j]);
- sb.append(',');
- continue;
- case kelondroColumn.celltype_string:
- sb.append(row[i].nickname());
- sb.append('=');
- for (int j = colstart[i]; j < colstart[i] + cellwidth; j++) sb.append((char) rowinstance[j]);
- sb.append(',');
- continue;
- case kelondroColumn.celltype_cardinal:
- if (decimalCardinal) {
- sb.append(row[i].nickname());
- sb.append('=');
- sb.append(Long.toString(bytes2long(rowinstance, colstart[i], cellwidth)));
- sb.append(',');
- continue;
- } else if (encoder == kelondroColumn.encoder_b64e) {
- sb.append(row[i].nickname());
- sb.append('=');
- long c = bytes2long(rowinstance, colstart[i], cellwidth);
- sb.append(kelondroBase64Order.enhancedCoder.encodeLongSmart(c, cellwidth).getBytes());
- sb.append(',');
- continue;
- } else throw new kelondroException("ROW", "toEncodedForm of celltype cardinal has no encoder (" + encoder + ")");
- }
+ bb.append(row[i].nickname());
+ bb.append('=');
+ bb.append(rowinstance, colstart[i], row[i].cellwidth());
+ bb.append(',');
}
- if (sb.charAt(sb.length() - 1) == ',') sb.deleteCharAt(sb.length() - 1); // remove ',' at end
- if (includeBraces) sb.append("}");
- return sb.toString();
+ if (bb.byteAt(bb.length() - 1) == ',') bb.deleteByteAt(bb.length() - 1); // remove ',' at end
+ if (includeBraces) bb.append('}');
+ //System.out.println("DEBUG-ROW " + bb.toString());
+ return bb.toString();
}
public String toString() {
diff --git a/source/de/anomic/plasma/plasmaCrawlLURL.java b/source/de/anomic/plasma/plasmaCrawlLURL.java
index 1501ade5d..0856c82a2 100644
--- a/source/de/anomic/plasma/plasmaCrawlLURL.java
+++ b/source/de/anomic/plasma/plasmaCrawlLURL.java
@@ -168,8 +168,8 @@ public final class plasmaCrawlLURL extends indexURL {
// - look into the hash cache
// - look into the filed properties
// if the url cannot be found, this returns null
- kelondroRow.Entry entry = urlIndexFile.get(urlHash.getBytes());
- if (entry == null) entry = urlIndexCache.get(urlHash.getBytes());
+ kelondroRow.Entry entry = urlIndexCache.get(urlHash.getBytes());
+ if (entry == null) entry = urlIndexFile.get(urlHash.getBytes());
if (entry == null) return null;
return new Entry(entry, searchedWord);
}
diff --git a/source/de/anomic/server/serverByteBuffer.java b/source/de/anomic/server/serverByteBuffer.java
index e481eb323..6db3f2c4f 100644
--- a/source/de/anomic/server/serverByteBuffer.java
+++ b/source/de/anomic/server/serverByteBuffer.java
@@ -203,6 +203,16 @@ public final class serverByteBuffer extends OutputStream {
return buffer[offset + pos];
}
+ public void deleteByteAt(int pos) {
+ if (pos < 0) return;
+ if (pos >= length) return;
+ if (pos == length - 1) {
+ length--;
+ } else {
+ System.arraycopy(buffer, offset + pos + 1, buffer, offset + pos, length - pos - 1);
+ }
+ }
+
public int indexOf(byte b) {
return indexOf(b, 0);
}