bugfix for kelondroRow - property generation

this bug affected ranking parameters :-(

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2506 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 18 years ago
parent 59a5511dbb
commit a2525072f2

@ -108,6 +108,7 @@ public class indexURLEntry implements Cloneable, indexEntry {
this.entry.setCol(col_worddistance, worddistance); this.entry.setCol(col_worddistance, worddistance);
this.entry.setCol(col_wordcount, wordcount); this.entry.setCol(col_wordcount, wordcount);
this.entry.setCol(col_phrasecount, phrasecount); this.entry.setCol(col_phrasecount, phrasecount);
//System.out.println("DEBUG-NEWENTRY " + toPropertyForm());
} }
public indexURLEntry(String urlHash, String code) { public indexURLEntry(String urlHash, String code) {

@ -33,6 +33,8 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import de.anomic.server.serverByteBuffer;
public class kelondroRow { public class kelondroRow {
protected kelondroColumn[] row; protected kelondroColumn[] row;
@ -369,49 +371,18 @@ public class kelondroRow {
} }
public String toPropertyForm(boolean includeBraces, boolean decimalCardinal) { public String toPropertyForm(boolean includeBraces, boolean decimalCardinal) {
StringBuffer sb = new StringBuffer(); serverByteBuffer bb = new serverByteBuffer();
if (includeBraces) sb.append("{"); if (includeBraces) bb.append('{');
int encoder, cellwidth;
for (int i = 0; i < row.length; i++) { for (int i = 0; i < row.length; i++) {
encoder = row[i].encoder(); bb.append(row[i].nickname());
cellwidth = row[i].cellwidth(); bb.append('=');
switch (row[i].celltype()) { bb.append(rowinstance, colstart[i], row[i].cellwidth());
case kelondroColumn.celltype_undefined: bb.append(',');
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 + ")");
}
} }
if (sb.charAt(sb.length() - 1) == ',') sb.deleteCharAt(sb.length() - 1); // remove ',' at end if (bb.byteAt(bb.length() - 1) == ',') bb.deleteByteAt(bb.length() - 1); // remove ',' at end
if (includeBraces) sb.append("}"); if (includeBraces) bb.append('}');
return sb.toString(); //System.out.println("DEBUG-ROW " + bb.toString());
return bb.toString();
} }
public String toString() { public String toString() {

@ -168,8 +168,8 @@ public final class plasmaCrawlLURL extends indexURL {
// - look into the hash cache // - look into the hash cache
// - look into the filed properties // - look into the filed properties
// if the url cannot be found, this returns null // if the url cannot be found, this returns null
kelondroRow.Entry entry = urlIndexFile.get(urlHash.getBytes()); kelondroRow.Entry entry = urlIndexCache.get(urlHash.getBytes());
if (entry == null) entry = urlIndexCache.get(urlHash.getBytes()); if (entry == null) entry = urlIndexFile.get(urlHash.getBytes());
if (entry == null) return null; if (entry == null) return null;
return new Entry(entry, searchedWord); return new Entry(entry, searchedWord);
} }

@ -203,6 +203,16 @@ public final class serverByteBuffer extends OutputStream {
return buffer[offset + pos]; 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) { public int indexOf(byte b) {
return indexOf(b, 0); return indexOf(b, 0);
} }

Loading…
Cancel
Save