Skip to content

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

SRU compliance according to http://www.loc.gov/standards/sru/specs/search-retrieve.html The example given on this page can be used to retrieve opensearch-compatible rss pages with YaCy

orbiter2c0c8f0f0c06
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index c01b31ce8..279e1f0d7 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -91,7 +91,7 @@ public class yacysearch {
String client = (String) header.get(httpHeader.CONNECTION_PROP_CLIENTIP); // the search client who initiated the search
// get query
- String querystring = (post == null) ? "" : post.get("search", "").trim();
+ String querystring = (post == null) ? "" : post.get("query", post.get("search", "")).trim(); // SRU compliance
boolean rss = (post == null) ? false : post.get("rss", "false").equals("true");
if ((post == null) || (env == null) || (querystring.length() == 0) || (!searchAllowed)) {
@@ -137,8 +137,9 @@ public class yacysearch {
}
if (sb.facilityDB != null) try { sb.facilityDB.update("zeitgeist", querystring, post); } catch (Exception e) {}
- int itemsPerPage = post.getInt("count", 10);
- int offset = post.getInt("offset", 0);
+ int itemsPerPage = post.getInt("maximumRecords", post.getInt("count", 10)); // SRU syntax with old property as alternative
+ int offset = post.getInt("startRecord", post.getInt("offset", 0));
+
boolean global = (post == null) ? true : post.get("resource", "global").equals("global");
final boolean indexof = post.get("indexof","").equals("on");
String urlmask = "";