Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fix for long periods in timeline
orbiter2073e69034c0
diff --git a/htroot/api/timeline_p.java b/htroot/api/timeline_p.javaindex 783ff5056..a22bac185 100644--- a/htroot/api/timeline_p.java+++ b/htroot/api/timeline_p.java@@ -54,16 +54,16 @@ public final class timeline_p {// get type of data to be listed in the timelineint maxeventsperperiod = post.getInt("head", 1); // the maximum number of events per periodString period = post.get("period", ""); // must be an integer with a character c at the end, c = Y|M|d|h|m|s- int periodlength = 0;+ long periodlength = 0;if (period.length() > 0) {char c = period.charAt(period.length() - 1);- int p = Integer.parseInt(period.substring(0, period.length() - 1));- if (c == 's') periodlength = p * 1000;- else if (c == 'm') periodlength = p * 1000 * 60;- else if (c == 'h') periodlength = p * 1000 * 60 * 60;- else if (c == 'd') periodlength = p * 1000 * 60 * 60 * 24;- else if (c == 'M') periodlength = p * 1000 * 60 * 60 * 24 * 30;- else if (c == 'Y') periodlength = p * 1000 * 60 * 60 * 24 * 365;+ long p = Long.parseLong(period.substring(0, period.length() - 1));+ if (c == 's') periodlength = p * 1000L;+ else if (c == 'm') periodlength = p * 1000L * 60L;+ else if (c == 'h') periodlength = p * 1000L * 60L * 60L;+ else if (c == 'd') periodlength = p * 1000L * 60L * 60L * 24L;+ else if (c == 'M') periodlength = p * 1000L * 60L * 60L * 24L * 30L;+ else if (c == 'Y' || c == 'y') periodlength = p * 1000L * 60L * 60L * 24L * 365L;else periodlength = 0;}final String[] data = post.get("data", "").split(","); // a string of word hashes that shall be searched and combined@@ -131,7 +131,7 @@ public final class timeline_p {return prop;}- private static void stats(OrderedScoreMap<String> accumulation, List<EventTracker.Event> eap, long startDate, int periodlength, int head, String type) {+ private static void stats(OrderedScoreMap<String> accumulation, List<EventTracker.Event> eap, long startDate, long periodlength, int head, String type) {// write accumulation of the score map into eapIterator<String> si = accumulation.keys(false);int c = 0;diff --git a/source/net/yacy/search/EventTracker.java b/source/net/yacy/search/EventTracker.javaindex 2fba99a11..2479e285c 100644--- a/source/net/yacy/search/EventTracker.java+++ b/source/net/yacy/search/EventTracker.java@@ -131,17 +131,17 @@ public class EventTracker {public final static class Event {final private Object time; // either a String in SHORT_SECOND format, a Long with ms since epoch or Date;- final public int duration; // ms+ final public long duration; // msfinal public String type;final public Object payload;final public int count;- public Event(final Date time, final int duration, final String type, final Object payload, final int count) {+ public Event(final Date time, final long duration, final String type, final Object payload, final int count) {this.time = time; this.duration = duration; this.type = type; this.payload = payload; this.count = count;}- public Event(final Long time, final int duration, final String type, final Object payload, final int count) {+ public Event(final Long time, final long duration, final String type, final Object payload, final int count) {this.time = time; this.duration = duration; this.type = type; this.payload = payload; this.count = count;}- public Event(final String time, final int duration, final String type, final Object payload, final int count) {+ public Event(final String time, final long duration, final String type, final Object payload, final int count) {this.time = time; this.duration = duration; this.type = type; this.payload = payload; this.count = count;}public String getFormattedDate() {