Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- fixed num parameter in GSA api - changed FS attribute in GSA api

Michael Peter Christen3b19fe7b5297
diff --git a/htroot/gsa/searchresult.java b/htroot/gsa/searchresult.java
index 28d1c56e7..37bb5a64f 100644
--- a/htroot/gsa/searchresult.java
+++ b/htroot/gsa/searchresult.java
@@ -102,8 +102,7 @@ public class searchresult {
//post.put(, post.remove("output"));//required, example: xml,xml_no_dtd
String q = post.get(CommonParams.Q, "");
post.put(CommonParams.ROWS, post.remove("num"));
- post.put(CommonParams.ROWS, Math.min(post.getInt("num", 10), (authenticated) ? 5000 : 100));
- post.remove("num");
+ post.put(CommonParams.ROWS, Math.min(post.getInt(CommonParams.ROWS, 10), (authenticated) ? 5000 : 100));
post.put("hl", "true");
post.put("hl.fl", "text_t,h1,h2");
post.put("hl.simple.pre", "<b>");
diff --git a/source/net/yacy/cora/protocol/HeaderFramework.java b/source/net/yacy/cora/protocol/HeaderFramework.java
index e519cc9df..7f65422d9 100644
--- a/source/net/yacy/cora/protocol/HeaderFramework.java
+++ b/source/net/yacy/cora/protocol/HeaderFramework.java
@@ -250,9 +250,11 @@ public class HeaderFramework extends TreeMap<String, String> implements Map<Stri
private static final String PATTERN_RFC1123 = "EEE, dd MMM yyyy HH:mm:ss Z"; // with numeric time zone indicator as defined in RFC5322
private static final String PATTERN_RFC1036 = "EEEE, dd-MMM-yy HH:mm:ss zzz";
private static final String PATTERN_ANSIC = "EEE MMM d HH:mm:ss yyyy";
+ private static final String PATTERN_GSAFS = "yyyy-MM-dd";
private static final SimpleDateFormat FORMAT_RFC1123 = new SimpleDateFormat(PATTERN_RFC1123, Locale.US);
private static final SimpleDateFormat FORMAT_RFC1036 = new SimpleDateFormat(PATTERN_RFC1036, Locale.US);
private static final SimpleDateFormat FORMAT_ANSIC = new SimpleDateFormat(PATTERN_ANSIC, Locale.US);
+ private static final SimpleDateFormat FORMAT_GSAFS = new SimpleDateFormat(PATTERN_GSAFS, Locale.US);
private static final TimeZone TZ_GMT = TimeZone.getTimeZone("GMT");
private static final Calendar CAL_GMT = Calendar.getInstance(TZ_GMT, Locale.US);
@@ -287,6 +289,14 @@ public class HeaderFramework extends TreeMap<String, String> implements Map<Stri
}
}
+ public static final String formatGSAFS(final Date date) {
+ if (date == null) return "";
+ synchronized (FORMAT_GSAFS) {
+ final String s = FORMAT_GSAFS.format(date);
+ return s;
+ }
+ }
+
/** Initialization of static formats */
static {
// 2-digit dates are automatically parsed by SimpleDateFormat,
@@ -611,12 +621,15 @@ public class HeaderFramework extends TreeMap<String, String> implements Map<Stri
this.k = k;
this.v = v;
}
+ @Override
public String getKey() {
return this.k;
}
+ @Override
public String getValue() {
return this.v;
}
+ @Override
public String setValue(final String v) {
final String r = this.v;
this.v = v;
diff --git a/source/net/yacy/cora/services/federated/solr/GSAResponseWriter.java b/source/net/yacy/cora/services/federated/solr/GSAResponseWriter.java
index 4ec06a27a..49bb0378c 100644
--- a/source/net/yacy/cora/services/federated/solr/GSAResponseWriter.java
+++ b/source/net/yacy/cora/services/federated/solr/GSAResponseWriter.java
@@ -233,7 +233,8 @@ public class GSAResponseWriter implements QueryResponseWriter {
}
if (YaCySchema.last_modified.name().equals(fieldName)) {
Date d = new Date(Long.parseLong(value.stringValue()));
- OpensearchResponseWriter.solitaireTag(writer, GSAToken.CACHE_LAST_MODIFIED.name(), HeaderFramework.formatRFC1123(d));
+ writer.write("<FS NAME=\"date\" VALUE=\"" + HeaderFramework.formatGSAFS(d) + "\"/>");
+ //OpensearchResponseWriter.solitaireTag(writer, GSAToken.CACHE_LAST_MODIFIED.name(), HeaderFramework.formatRFC1123(d));
texts.add(value.stringValue());
continue;
}