mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
fix for long periods in timeline
This commit is contained in:
parent
1f94df29e7
commit
2073e69034
|
@ -54,16 +54,16 @@ public final class timeline_p {
|
||||||
// get type of data to be listed in the timeline
|
// get type of data to be listed in the timeline
|
||||||
int maxeventsperperiod = post.getInt("head", 1); // the maximum number of events per period
|
int maxeventsperperiod = post.getInt("head", 1); // the maximum number of events per period
|
||||||
String period = post.get("period", ""); // must be an integer with a character c at the end, c = Y|M|d|h|m|s
|
String 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) {
|
if (period.length() > 0) {
|
||||||
char c = period.charAt(period.length() - 1);
|
char c = period.charAt(period.length() - 1);
|
||||||
int p = Integer.parseInt(period.substring(0, period.length() - 1));
|
long p = Long.parseLong(period.substring(0, period.length() - 1));
|
||||||
if (c == 's') periodlength = p * 1000;
|
if (c == 's') periodlength = p * 1000L;
|
||||||
else if (c == 'm') periodlength = p * 1000 * 60;
|
else if (c == 'm') periodlength = p * 1000L * 60L;
|
||||||
else if (c == 'h') periodlength = p * 1000 * 60 * 60;
|
else if (c == 'h') periodlength = p * 1000L * 60L * 60L;
|
||||||
else if (c == 'd') periodlength = p * 1000 * 60 * 60 * 24;
|
else if (c == 'd') periodlength = p * 1000L * 60L * 60L * 24L;
|
||||||
else if (c == 'M') periodlength = p * 1000 * 60 * 60 * 24 * 30;
|
else if (c == 'M') periodlength = p * 1000L * 60L * 60L * 24L * 30L;
|
||||||
else if (c == 'Y') periodlength = p * 1000 * 60 * 60 * 24 * 365;
|
else if (c == 'Y' || c == 'y') periodlength = p * 1000L * 60L * 60L * 24L * 365L;
|
||||||
else periodlength = 0;
|
else periodlength = 0;
|
||||||
}
|
}
|
||||||
final String[] data = post.get("data", "").split(","); // a string of word hashes that shall be searched and combined
|
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;
|
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 eap
|
// write accumulation of the score map into eap
|
||||||
Iterator<String> si = accumulation.keys(false);
|
Iterator<String> si = accumulation.keys(false);
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
|
@ -131,17 +131,17 @@ public class EventTracker {
|
||||||
|
|
||||||
public final static class Event {
|
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 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; // ms
|
||||||
final public String type;
|
final public String type;
|
||||||
final public Object payload;
|
final public Object payload;
|
||||||
final public int count;
|
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;
|
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;
|
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;
|
this.time = time; this.duration = duration; this.type = type; this.payload = payload; this.count = count;
|
||||||
}
|
}
|
||||||
public String getFormattedDate() {
|
public String getFormattedDate() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user