Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added option to reverse-sort YaCy tables (internal API change only)
orbiter3ac31614a36f
diff --git a/htroot/Table_YMark_p.java b/htroot/Table_YMark_p.javaindex 482d6ca13..13bdae6aa 100644--- a/htroot/Table_YMark_p.java+++ b/htroot/Table_YMark_p.java@@ -243,7 +243,7 @@ public class Table_YMark_p {final String tagsString = YMarkUtil.cleanTagsString(post.get(YMarkEntry.BOOKMARK.TAGS.key()));mapIterator = sb.tables.bookmarks.getBookmarksByTag(bmk_user, tagsString);} else {- mapIterator = sb.tables.orderByPK(sb.tables.iterator(table, matcher), maxcount).iterator();+ mapIterator = sb.tables.orderByPK(sb.tables.iterator(table, matcher), maxcount, false).iterator();}Tables.Row row;diff --git a/htroot/Tables_p.java b/htroot/Tables_p.javaindex 640f38352..784c4da8a 100644--- a/htroot/Tables_p.java+++ b/htroot/Tables_p.java@@ -160,7 +160,7 @@ public class Tables_p {count = 0;try {final Iterator<Tables.Row> plainIterator = sb.tables.iterator(table, matcher);- final Iterator<Tables.Row> mapIterator = sb.tables.orderByPK(plainIterator, maxcount).iterator();+ final Iterator<Tables.Row> mapIterator = sb.tables.orderByPK(plainIterator, maxcount, false).iterator();Tables.Row row;boolean dark = true;byte[] cell;diff --git a/htroot/api/table_p.java b/htroot/api/table_p.javaindex 2df19a36d..ba7b3b2b1 100644--- a/htroot/api/table_p.java+++ b/htroot/api/table_p.java@@ -155,7 +155,7 @@ public class table_p {int count = 0;try {final Iterator<Tables.Row> plainIterator = sb.tables.iterator(table, matcher);- final Iterator<Tables.Row> mapIterator = sb.tables.orderByPK(plainIterator, maxcount).iterator();+ final Iterator<Tables.Row> mapIterator = sb.tables.orderByPK(plainIterator, maxcount, false).iterator();Tables.Row trow;boolean dark = true;String cellName, cellValue;diff --git a/source/net/yacy/crawler/CrawlSwitchboard.java b/source/net/yacy/crawler/CrawlSwitchboard.javaindex 82d1b0fc9..ce70b58e5 100644--- a/source/net/yacy/crawler/CrawlSwitchboard.java+++ b/source/net/yacy/crawler/CrawlSwitchboard.java@@ -676,12 +676,10 @@ public final class CrawlSwitchboard {try {ret = new MapHeap(file, Word.commonHashLength, NaturalOrder.naturalOrder, 1024 * 64, 500, ' ');} catch (final IOException e ) {- ConcurrentLog.logException(e);ConcurrentLog.logException(e);FileUtils.deletedelete(file);try {- ret =- new MapHeap(file, Word.commonHashLength, NaturalOrder.naturalOrder, 1024 * 64, 500, ' ');+ ret = new MapHeap(file, Word.commonHashLength, NaturalOrder.naturalOrder, 1024 * 64, 500, ' ');} catch (final IOException e1 ) {ConcurrentLog.logException(e1);ret = null;diff --git a/source/net/yacy/kelondro/blob/Tables.java b/source/net/yacy/kelondro/blob/Tables.javaindex 36a44d634..57418e880 100644--- a/source/net/yacy/kelondro/blob/Tables.java+++ b/source/net/yacy/kelondro/blob/Tables.java@@ -454,14 +454,14 @@ public class Tables implements Iterable<String> {return new RowIterator(table, wherePattern);}- public Collection<Row> orderByPK(final Iterator<Row> rowIterator, int maxcount) {+ public Collection<Row> orderByPK(final Iterator<Row> rowIterator, int maxcount, boolean reverse) {final TreeMap<String, Row> sortTree = new TreeMap<String, Row>();Row row;while ((maxcount < 0 || maxcount-- > 0) && rowIterator.hasNext()) {row = rowIterator.next();sortTree.put(UTF8.String(row.pk), row);}- return sortTree.values();+ return reverse ? sortTree.descendingMap().values() : sortTree.values();}public Collection<Row> orderBy(final Iterator<Row> rowIterator, int maxcount, final String sortColumn) {