extended the serverObjects to be able to hold multipel values for a

single key. This is done using the solr class MultiMapSolrParams. That
class is needed in the OpensearchResultWriter to get multiple facet
requests.
pull/1/head
Michael Peter Christen 12 years ago
parent d70d99fab5
commit 762b687e47

@ -144,13 +144,13 @@ public class searchresult {
} else { } else {
post.put(CommonParams.SORT, sorts); post.put(CommonParams.SORT, sorts);
} }
String site = post.remove("site"); // example: col1|col2 String[] site = post.remove("site"); // example: col1|col2
String access = post.remove("access"); String[] access = post.remove("access");
String entqr = post.remove("entqr"); String[] entqr = post.remove("entqr");
// add sites operator // add sites operator
if (site != null && site.length() > 0) { if (site != null && site[0].length() > 0) {
String[] s0 = CommonPattern.VERTICALBAR.split(site); String[] s0 = CommonPattern.VERTICALBAR.split(site[0]);
ArrayList<String> sites = new ArrayList<String>(2); ArrayList<String> sites = new ArrayList<String>(2);
for (String s: s0) { for (String s: s0) {
s = s.trim().toLowerCase(); s = s.trim().toLowerCase();
@ -189,8 +189,8 @@ public class searchresult {
context.put("client", "vsm_frontent"); context.put("client", "vsm_frontent");
context.put("sort", sort.sort); context.put("sort", sort.sort);
context.put("site", site == null ? "" : site); context.put("site", site == null ? "" : site);
context.put("access", access == null ? "p" : access); context.put("access", access == null ? "p" : access[0]);
context.put("entqr", entqr == null ? "3" : entqr); context.put("entqr", entqr == null ? "3" : entqr[0]);
// write the result directly to the output stream // write the result directly to the output stream
Writer ow = new FastWriter(new OutputStreamWriter(out, UTF8.charset)); Writer ow = new FastWriter(new OutputStreamWriter(out, UTF8.charset));

@ -104,8 +104,8 @@ public class WorkTables extends Tables {
*/ */
public byte[] recordAPICall(final serverObjects post, final String servletName, final String type, final String comment) { public byte[] recordAPICall(final serverObjects post, final String servletName, final String type, final String comment) {
// remove the apicall attributes from the post object // remove the apicall attributes from the post object
String pks = post.remove(TABLE_API_COL_APICALL_PK); String[] pks = post.remove(TABLE_API_COL_APICALL_PK);
byte[] pk = pks == null ? null : UTF8.getBytes(pks); byte[] pk = pks == null ? null : UTF8.getBytes(pks[0]);
// generate the apicall url - without the apicall attributes // generate the apicall url - without the apicall attributes
final String apiurl = /*"http://localhost:" + getConfig("port", "8090") +*/ "/" + servletName + "?" + post.toString(); final String apiurl = /*"http://localhost:" + getConfig("port", "8090") +*/ "/" + servletName + "?" + post.toString();

@ -366,7 +366,7 @@ public final class HTTPDFileHandler {
serverCore.bfHost.remove(conProp.get(HeaderFramework.CONNECTION_PROP_CLIENTIP)); serverCore.bfHost.remove(conProp.get(HeaderFramework.CONNECTION_PROP_CLIENTIP));
// parse arguments // parse arguments
serverObjects args = new serverObjects(); serverObjects args = new serverObjects(true);
int argc = 0; int argc = 0;
if (argsString == null) { if (argsString == null) {
// no args here, maybe a POST with multipart extension // no args here, maybe a POST with multipart extension

@ -329,7 +329,7 @@ public final class HTTPDemon implements serverHandler, Cloneable {
if (returncode == UserDB.Entry.PROXY_ALLOK) { if (returncode == UserDB.Entry.PROXY_ALLOK) {
return true; return true;
} }
final serverObjects tp = new serverObjects(); final serverObjects tp = new serverObjects(true);
if (returncode == UserDB.Entry.PROXY_TIMELIMIT_REACHED) { if (returncode == UserDB.Entry.PROXY_TIMELIMIT_REACHED) {
tp.put("limit", "1");//time per day tp.put("limit", "1");//time per day
tp.put("limit_timelimit", entry.getTimeLimit()); tp.put("limit_timelimit", entry.getTimeLimit());
@ -1075,7 +1075,7 @@ public final class HTTPDemon implements serverHandler, Cloneable {
} }
// set rewrite values // set rewrite values
final serverObjects tp = new serverObjects(); final serverObjects tp = new serverObjects(true);
String clientIP = (String) conProp.get(HeaderFramework.CONNECTION_PROP_CLIENTIP); if (clientIP == null) clientIP = Domains.LOCALHOST; String clientIP = (String) conProp.get(HeaderFramework.CONNECTION_PROP_CLIENTIP); if (clientIP == null) clientIP = Domains.LOCALHOST;

@ -55,14 +55,13 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PushbackInputStream; import java.io.PushbackInputStream;
import java.util.HashMap;
import java.util.Map;
import net.yacy.cora.document.ASCII; import net.yacy.cora.document.ASCII;
import net.yacy.cora.document.UTF8; import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.logging.Log; import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.util.ByteBuffer; import net.yacy.kelondro.util.ByteBuffer;
import net.yacy.kelondro.util.FileUtils; import net.yacy.kelondro.util.FileUtils;
import net.yacy.server.serverObjects;
/** /**
@ -193,7 +192,7 @@ public final class TemplateEngine {
return false; return false;
} }
public final static void writeTemplate(final InputStream in, final OutputStream out, final Map<String, String> pattern, final byte[] dflt) throws IOException { public final static void writeTemplate(final InputStream in, final OutputStream out, final serverObjects pattern, final byte[] dflt) throws IOException {
if (pattern == null) { if (pattern == null) {
FileUtils.copy(in, out); FileUtils.copy(in, out);
} else { } else {
@ -204,7 +203,7 @@ public final class TemplateEngine {
/** /**
* Reads a input stream, and writes the data with replaced templates on a output stream * Reads a input stream, and writes the data with replaced templates on a output stream
*/ */
private final static byte[] writeTemplate(final InputStream in, final OutputStream out, final Map<String, String> pattern, final byte[] dflt, final byte[] prefix) throws IOException { private final static byte[] writeTemplate(final InputStream in, final OutputStream out, final serverObjects pattern, final byte[] dflt, final byte[] prefix) throws IOException {
final PushbackInputStream pis = new PushbackInputStream(in, 100); final PushbackInputStream pis = new PushbackInputStream(in, 100);
final ByteArrayOutputStream keyStream = new ByteArrayOutputStream(4048); final ByteArrayOutputStream keyStream = new ByteArrayOutputStream(4048);
byte[] key; byte[] key;
@ -437,7 +436,7 @@ public final class TemplateEngine {
return sb; return sb;
} }
private final static byte[] replacePattern(final String key, final Map<String, String> pattern, final byte dflt[]) { private final static byte[] replacePattern(final String key, final serverObjects pattern, final byte dflt[]) {
byte[] replacement; byte[] replacement;
Object value; Object value;
if (pattern.containsKey(key)) { if (pattern.containsKey(key)) {
@ -512,7 +511,7 @@ public final class TemplateEngine {
// arg1 = test input; arg2 = replacement for pattern 'test'; arg3 = default replacement // arg1 = test input; arg2 = replacement for pattern 'test'; arg3 = default replacement
try { try {
final InputStream i = new ByteArrayInputStream(UTF8.getBytes(args[0])); final InputStream i = new ByteArrayInputStream(UTF8.getBytes(args[0]));
final Map<String, String> h = new HashMap<String, String>(); final serverObjects h = new serverObjects(true);
h.put("test", args[1]); h.put("test", args[1]);
writeTemplate(new PushbackInputStream(i, 100), System.out, h, UTF8.getBytes(args[2])); writeTemplate(new PushbackInputStream(i, 100), System.out, h, UTF8.getBytes(args[2]));
System.out.flush(); System.out.flush();

Loading…
Cancel
Save