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
This commit is contained in:
orbiter 2006-09-07 10:55:34 +00:00
parent 59a5511dbb
commit a2525072f2
4 changed files with 25 additions and 43 deletions

View File

@ -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) {

View File

@ -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() {

View File

@ -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);
}

View File

@ -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);
}