Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
gsa bugfix for date parser
Michael Peter Christen0ad52ac4c342
diff --git a/htroot/gsa/searchresult.java b/htroot/gsa/searchresult.javaindex 546214e17..548cae36e 100644--- a/htroot/gsa/searchresult.java+++ b/htroot/gsa/searchresult.java@@ -30,7 +30,6 @@ import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.services.federated.solr.GSAResponseWriter;import net.yacy.kelondro.logging.Log;import net.yacy.search.Switchboard;-import net.yacy.search.index.YaCySchema;import net.yacy.search.solr.EmbeddedSolrConnector;import org.apache.solr.common.SolrException;@@ -65,23 +64,6 @@ public class searchresult {return "text/xml";}- public static class Sort {- public String sort, action, direction, mode, format;- public Sort(String d) {- this.sort = d;- String[] s = d.split(":");- this.action = s[0]; // date- this.direction = s[1]; // A or D- this.mode = s[2]; // S, R, L- this.format = s[3]; // d1- }- public String toSolr() {- if ("date".equals(this.action)) {- return YaCySchema.last_modified.name() + " " + (("D".equals(this.direction) ? "desc" : "asc"));- }- return null;- }- }/*** @param header@@ -118,7 +100,7 @@ public class searchresult {post.put(CommonParams.ROWS, post.remove("num"));post.put(CommonParams.ROWS, Math.min(post.getInt("num", 10), (authenticated) ? 5000 : 100));post.remove("num");- Sort sort = new Sort(post.get(CommonParams.SORT, ""));+ GSAResponseWriter.Sort sort = new GSAResponseWriter.Sort(post.get(CommonParams.SORT, ""));String sorts = sort.toSolr();if (sorts == null) {post.remove(CommonParams.SORT);diff --git a/source/net/yacy/cora/services/federated/solr/GSAResponseWriter.java b/source/net/yacy/cora/services/federated/solr/GSAResponseWriter.javaindex a6f219456..cb1a4542a 100644--- a/source/net/yacy/cora/services/federated/solr/GSAResponseWriter.java+++ b/source/net/yacy/cora/services/federated/solr/GSAResponseWriter.java@@ -98,6 +98,25 @@ public class GSAResponseWriter implements QueryResponseWriter {//public float maxScore;}+ public static class Sort {+ public String sort = null, action = null, direction = null, mode = null, format = null;+ public Sort(String d) {+ this.sort = d;+ String[] s = d.split(":");+ if (s.length != 4) return;+ this.action = s[0]; // date+ this.direction = s[1]; // A or D+ this.mode = s[2]; // S, R, L+ this.format = s[3]; // d1+ }+ public String toSolr() {+ if ("date".equals(this.action)) {+ return YaCySchema.last_modified.name() + " " + (("D".equals(this.direction) ? "desc" : "asc"));+ }+ return null;+ }+ }+public GSAResponseWriter() {super();}@@ -166,7 +185,7 @@ public class GSAResponseWriter implements QueryResponseWriter {SolrIndexSearcher searcher = request.getSearcher();DocIterator iterator = response.iterator();for (int i = 0; i < responseCount; i++) {- writer.write("<R N=\"" + (resHead.offset + i + 1) + "\"" + (i == 1 ? " L=\"\"" : "") + ">"); writer.write(lb);+ writer.write("<R N=\"" + (resHead.offset + i + 1) + "\"" + (i == 1 ? " L=\"2\"" : "") + ">"); writer.write(lb);int id = iterator.nextDoc();Document doc = searcher.doc(id, SOLR_FIELDS);List<Fieldable> fields = doc.getFields();