diff --git a/source/de/anomic/kelondro/kelondroCollection.java b/source/de/anomic/kelondro/kelondroCollection.java index a75c73501..40073a617 100644 --- a/source/de/anomic/kelondro/kelondroCollection.java +++ b/source/de/anomic/kelondro/kelondroCollection.java @@ -313,7 +313,7 @@ public class kelondroCollection { sort(keylen); } - private void sort(int keylen) { + public void sort(int keylen) { assert (this.order != null); if (this.sortbound == this.chunkcount) return; // this is already sorted //System.out.println("SORT"); diff --git a/source/de/anomic/kelondro/kelondroCollectionIntMap.java b/source/de/anomic/kelondro/kelondroCollectionIntMap.java index b87919b20..64a16e446 100644 --- a/source/de/anomic/kelondro/kelondroCollectionIntMap.java +++ b/source/de/anomic/kelondro/kelondroCollectionIntMap.java @@ -38,6 +38,13 @@ public class kelondroCollectionIntMap extends kelondroCollection { this.setOrdering(kelondroNaturalOrder.naturalOrder); } + public void addi(byte[] key, int i) { + kelondroRow.Entry indexentry = indexrow.newEntry(); + indexentry.setCol(0, key); + indexentry.setColLongB256(1, i); + add(indexentry.bytes()); + } + public int puti(byte[] key, int i) { int index = -1; synchronized (chunkcache) { diff --git a/source/de/anomic/kelondro/kelondroFlexTable.java b/source/de/anomic/kelondro/kelondroFlexTable.java index 35e98771a..a47a7154f 100644 --- a/source/de/anomic/kelondro/kelondroFlexTable.java +++ b/source/de/anomic/kelondro/kelondroFlexTable.java @@ -42,9 +42,13 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr for (int i = 0; i < indexArray.size(); i++) index.put(indexArray.get(i).getColBytes(0), new Integer(i)); indexArray.close(); */ + System.out.print("Loading " + path); for (int i = 0; i < super.col[0].size(); i++) { - index.puti(super.col[0].get(i).getColBytes(0), i); + index.addi(super.col[0].get(i).getColBytes(0), i); + if ((i % 10000) == 0) System.out.print('.'); } + index.sort(super.row().width(0)); + System.out.println(index.size() + " index entries initialized and sorted"); this.index.setOrdering(kelondroNaturalOrder.naturalOrder); }