From d70d99fab5a355ec7b03521315014bdc26d641a9 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Mon, 11 Feb 2013 22:10:14 +0100 Subject: [PATCH] added more metadata fields and facets to OpensearchResponseWriter. This should make it possible to replace the original and enriched yacy opensearch result with a solr output in opensearch format. --- defaults/solr.keys.list | 2 +- htroot/yacysearchitem.java | 15 +- source/net/yacy/cora/document/RSSMessage.java | 10 + .../OpensearchResponseWriter.java | 80 +++++- .../cora/lod/vocabulary/YaCyMetadata.java | 4 + source/net/yacy/server/serverObjects.java | 245 ++++++++++++------ source/net/yacy/server/servletProperties.java | 8 +- 7 files changed, 258 insertions(+), 106 deletions(-) diff --git a/defaults/solr.keys.list b/defaults/solr.keys.list index af2da6828..d73fab485 100644 --- a/defaults/solr.keys.list +++ b/defaults/solr.keys.list @@ -107,7 +107,7 @@ applinkscount_i ## tags that are attached to crawls/index generation to separate the search result into user-defined subsets collection_sxt -## point in degrees of latitude,longitude as declared in WSG84, location +## geospatial point in degrees of latitude,longitude as declared in WSG84, location; this creates two additional subfields, coordinate_p_0_coordinate (latitude) and coordinate_p_1_coordinate (longitude) coordinate_p ## content of author-tag, texgen diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java index 130b50421..c66a5c891 100644 --- a/htroot/yacysearchitem.java +++ b/htroot/yacysearchitem.java @@ -29,6 +29,7 @@ import java.util.List; import net.yacy.cora.date.GenericFormatter; import net.yacy.cora.document.ASCII; +import net.yacy.cora.document.RSSMessage; import net.yacy.cora.document.analysis.Classification; import net.yacy.cora.document.analysis.Classification.ContentDomain; import net.yacy.cora.protocol.Domains; @@ -200,8 +201,8 @@ public class yacysearchitem { prop.put("content_date822", HeaderFramework.formatRFC1123(result.modified())); //prop.put("content_ybr", RankingProcess.ybr(result.hash())); prop.putHTML("content_size", Integer.toString(result.filesize())); // we don't use putNUM here because that number shall be usable as sorting key. To print the size, use 'sizename' - prop.putHTML("content_sizename", sizename(result.filesize())); - prop.putHTML("content_showSize_sizename", sizename(result.filesize())); + prop.putHTML("content_sizename", RSSMessage.sizename(result.filesize())); + prop.putHTML("content_showSize_sizename", RSSMessage.sizename(result.filesize())); prop.putHTML("content_host", resultURL.getHost() == null ? "" : resultURL.getHost()); prop.putHTML("content_file", resultURL.getFileName()); prop.putHTML("content_path", resultURL.getPath()); @@ -338,14 +339,4 @@ public class yacysearchitem { } return ret; } - - private static String sizename(int size) { - if (size < 1024) return size + " bytes"; - size = size / 1024; - if (size < 1024) return size + " kbyte"; - size = size / 1024; - if (size < 1024) return size + " mbyte"; - size = size / 1024; - return size + " gbyte"; - } } diff --git a/source/net/yacy/cora/document/RSSMessage.java b/source/net/yacy/cora/document/RSSMessage.java index f2445b4e1..aaad23248 100644 --- a/source/net/yacy/cora/document/RSSMessage.java +++ b/source/net/yacy/cora/document/RSSMessage.java @@ -325,4 +325,14 @@ public class RSSMessage implements Hit, Comparable, Comparator SOLR_FIELDS = new HashSet(); static { - field2tag.put(YaCySchema.sku.getSolrFieldName(), RSSMessage.Token.link.name()); + field2tag.put(YaCySchema.coordinate_p.getSolrFieldName() + "_0_coordinate", Geo.Lat.getURIref()); + field2tag.put(YaCySchema.coordinate_p.getSolrFieldName() + "_1_coordinate", Geo.Long.getURIref()); field2tag.put(YaCySchema.publisher_t.getSolrFieldName(), DublinCore.Publisher.getURIref()); field2tag.put(YaCySchema.author.getSolrFieldName(), DublinCore.Creator.getURIref()); SOLR_FIELDS.addAll(field2tag.keySet()); @@ -104,6 +109,10 @@ public class OpensearchResponseWriter implements QueryResponseWriter { SimpleOrderedMap responseHeader = (SimpleOrderedMap) rsp.getResponseHeader(); DocList response = ((ResultContext) values.get("response")).docs; @SuppressWarnings("unchecked") + SimpleOrderedMap facetCounts = (SimpleOrderedMap) values.get("facet_counts"); + @SuppressWarnings("unchecked") + SimpleOrderedMap facetFields = facetCounts == null || facetCounts.size() == 0 ? null : (SimpleOrderedMap) facetCounts.get("facet_fields"); + @SuppressWarnings("unchecked") SimpleOrderedMap highlighting = (SimpleOrderedMap) values.get("highlighting"); Map> snippets = highlighting(highlighting); @@ -165,7 +174,20 @@ public class OpensearchResponseWriter implements QueryResponseWriter { solitaireTag(writer, stag, value.stringValue()); continue; } - + + // take apart the url + if (YaCySchema.sku.getSolrFieldName().equals(fieldName)) { + String u = value.stringValue(); + solitaireTag(writer, RSSMessage.Token.link.name(), u); + try { + MultiProtocolURI url = new MultiProtocolURI(u); + solitaireTag(writer, YaCyMetadata.host.getURIref(), url.getHost()); + solitaireTag(writer, YaCyMetadata.path.getURIref(), url.getPath()); + solitaireTag(writer, YaCyMetadata.file.getURIref(), url.getFileName()); + } catch (MalformedURLException e) {} + continue; + } + // if the rule is not generic, use the specific here if (YaCySchema.id.getSolrFieldName().equals(fieldName)) { urlhash = value.stringValue(); @@ -192,6 +214,12 @@ public class OpensearchResponseWriter implements QueryResponseWriter { texts.add(value.stringValue()); continue; } + if (YaCySchema.size_i.getSolrFieldName().equals(fieldName)) { + int size = value.numericValue().intValue(); + solitaireTag(writer, YaCyMetadata.size.getURIref(), Integer.toString(size)); + solitaireTag(writer, YaCyMetadata.sizename.getURIref(), RSSMessage.sizename(size)); + continue; + } if (YaCySchema.h1_txt.getSolrFieldName().equals(fieldName) || YaCySchema.h2_txt.getSolrFieldName().equals(fieldName) || YaCySchema.h3_txt.getSolrFieldName().equals(fieldName) || YaCySchema.h4_txt.getSolrFieldName().equals(fieldName) || YaCySchema.h5_txt.getSolrFieldName().equals(fieldName) || YaCySchema.h6_txt.getSolrFieldName().equals(fieldName)) { @@ -200,21 +228,58 @@ public class OpensearchResponseWriter implements QueryResponseWriter { continue; } } + // compute snippet from texts - solitaireTag(writer, RSSMessage.Token.title.name(), title.length() == 0 ? (texts.size() == 0 ? "" : texts.get(0)) : title); List snippet = urlhash == null ? null : snippets.get(urlhash); String tagname = RSSMessage.Token.description.name(); writer.write("<"); writer.write(tagname); writer.write('>'); XML.escapeCharData(snippet == null || snippet.size() == 0 ? description : snippet.get(0), writer); writer.write("\n"); + + // open: where do we get the subject? + //solitaireTag(writer, DublinCore.Subject.getURIref(), ""); // TODO: fill with actual data + closeTag(writer, "item"); } + // the facets can be created with the options &facet=true&facet.mincount=1&facet.field=host_s&facet.field=url_file_ext_s&facet.field=url_protocol_s&facet.field=author_sxt + @SuppressWarnings("unchecked") + NamedList domains = facetFields == null ? null : (NamedList) facetFields.get(YaCySchema.host_s.getSolrFieldName()); + @SuppressWarnings("unchecked") + NamedList filetypes = facetFields == null ? null : (NamedList) facetFields.get(YaCySchema.url_file_ext_s.getSolrFieldName()); + @SuppressWarnings("unchecked") + NamedList protocols = facetFields == null ? null : (NamedList) facetFields.get(YaCySchema.url_protocol_s.getSolrFieldName()); + @SuppressWarnings("unchecked") + NamedList authors = facetFields == null ? null : (NamedList) facetFields.get(YaCySchema.author_sxt.getSolrFieldName()); + + openTag(writer, "yacy:navigation"); + if (domains != null) { + openTag(writer, "yacy:facet name=\"domains\" displayname=\"Domains\" type=\"String\" min=\"0\" max=\"0\" mean=\"0\""); + for (Map.Entry entry: domains) facetEntry(writer, entry.getKey(), Integer.toString(entry.getValue())); + closeTag(writer, "yacy:facet"); + } + if (filetypes != null) { + openTag(writer, "yacy:facet name=\"filetypes\" displayname=\"Filetypes\" type=\"String\" min=\"0\" max=\"0\" mean=\"0\""); + for (Map.Entry entry: filetypes) facetEntry(writer, entry.getKey(), Integer.toString(entry.getValue())); + closeTag(writer, "yacy:facet"); + } + if (protocols != null) { + openTag(writer, "yacy:facet name=\"protocols\" displayname=\"Protocols\" type=\"String\" min=\"0\" max=\"0\" mean=\"0\""); + for (Map.Entry entry: protocols) facetEntry(writer, entry.getKey(), Integer.toString(entry.getValue())); + closeTag(writer, "yacy:facet"); + } + if (authors != null) { + openTag(writer, "yacy:facet name=\"authors\" displayname=\"Authors\" type=\"String\" min=\"0\" max=\"0\" mean=\"0\""); + for (Map.Entry entry: authors) facetEntry(writer, entry.getKey(), Integer.toString(entry.getValue())); + closeTag(writer, "yacy:facet"); + } + closeTag(writer, "yacy:navigation"); + closeTag(writer, "channel"); writer.write("\n".toCharArray()); } - + /** * produce snippets from solr (they call that 'highlighting') * @param val @@ -269,4 +334,11 @@ public class OpensearchResponseWriter implements QueryResponseWriter { writer.write("\n"); } + private static void facetEntry(final Writer writer, final String propname, String value) throws IOException { + writer.write("\n"); + } + } diff --git a/source/net/yacy/cora/lod/vocabulary/YaCyMetadata.java b/source/net/yacy/cora/lod/vocabulary/YaCyMetadata.java index afe185b3b..ee7662761 100644 --- a/source/net/yacy/cora/lod/vocabulary/YaCyMetadata.java +++ b/source/net/yacy/cora/lod/vocabulary/YaCyMetadata.java @@ -37,12 +37,16 @@ import net.yacy.cora.lod.Vocabulary; public enum YaCyMetadata implements Vocabulary { hash, // the url's hash + host, // the url's host + path, // the path element of the url without file bname + file, // the file name inside the url mod, // last-modified from the httpd load, // time when the url was loaded fresh, // time until this url is fresh referrer, // (one of) the url's referrer hash(es) md5, // the md5 of the url content (to identify changes) size, // size of file in bytes + sizename, // printable version of the size wc, // size of file by number of words; for video and audio: seconds dt, // doctype, taken from extension or any other heuristic flags, // flags; any stuff (see Word-Entity definition) diff --git a/source/net/yacy/server/serverObjects.java b/source/net/yacy/server/serverObjects.java index 02f084c91..a7e67cedb 100644 --- a/source/net/yacy/server/serverObjects.java +++ b/source/net/yacy/server/serverObjects.java @@ -47,12 +47,16 @@ import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.net.InetAddress; +import java.util.AbstractMap; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.regex.Pattern; import net.yacy.cora.document.MultiProtocolURI; @@ -69,8 +73,9 @@ import org.apache.solr.common.params.MultiMapSolrParams; import org.apache.solr.common.params.SolrParams; -public class serverObjects extends HashMap implements Cloneable { - +public class serverObjects implements Serializable, Cloneable { + + private static final long serialVersionUID = 3999165204849858546L; public static final String ACTION_AUTHENTICATE = "AUTHENTICATE"; public static final String ACTION_LOCATION = "LOCATION"; public final static String ADMIN_AUTHENTICATE_MSG = "admin log-in. If you don't know the password, set it with {yacyhome}/bin/passwd.sh {newpassword}"; @@ -83,29 +88,89 @@ public class serverObjects extends HashMap implements Cloneable private final static Pattern patternR = Pattern.compile("\r"); private final static Pattern patternT = Pattern.compile("\t"); - private static final long serialVersionUID = 1L; private boolean localized = true; + private boolean allowMultipleEntries = false; private final static char BOM = '\uFEFF'; // ByteOrderMark character that may appear at beginnings of Strings (Browser may append that) - + private final MultiMapSolrParams map; + public serverObjects() { super(); + this.map = new MultiMapSolrParams(new HashMap()); } - protected serverObjects(final Map input) { - super(input); + public serverObjects(final boolean allowMultipleEntries) { + super(); + this.allowMultipleEntries = allowMultipleEntries; + this.map = new MultiMapSolrParams(new HashMap()); + } + + protected serverObjects(serverObjects o) { + super(); + this.map = o.map; + } + + protected serverObjects(final Map input) { + super(); + this.map = new MultiMapSolrParams(input); } public void authenticationRequired() { this.put(ACTION_AUTHENTICATE, ADMIN_AUTHENTICATE_MSG); } + public void clear() { + this.map.getMap().clear(); + } + + public boolean isEmpty() { + return this.map.getMap().isEmpty(); + } + private static final String removeByteOrderMark(final String s) { if (s == null || s.isEmpty()) return s; if (s.charAt(0) == BOM) return s.substring(1); return s; } + public boolean containsKey(String key) { + return this.map.get(key) != null; + } + + public MultiMapSolrParams getSolrParams() { + return this.map; + } + + public List> entrySet() { + List> set = new ArrayList>(this.map.getMap().size() * 2); + for (Map.Entry entry: this.map.getMap().entrySet()) { + for (String v: entry.getValue()) set.add(new AbstractMap.SimpleEntry(entry.getKey(), v)); + } + return set; + } + + public Set values() { + Set set = new HashSet(this.map.getMap().size() * 2); + for (Map.Entry entry: this.map.getMap().entrySet()) { + for (String v: entry.getValue()) set.add(v); + } + return set; + } + + public Set keySet() { + return this.map.getMap().keySet(); + } + + public String[] remove(String key) { + return this.map.getMap().remove(key); + } + + public void putAll(Map m) { + for (Map.Entry e: m.entrySet()) { + put(e.getKey(), e.getValue()); + } + } + /** * Add a key-value pair of Objects to the map. * @param key This method will do nothing if the key is null. @@ -115,30 +180,44 @@ public class serverObjects extends HashMap implements Cloneable * @return The value that was added to the map. * @see java.util.Hashtable#insert(K, V) */ - @Override - public String put(final String key, final String value) { + public void put(final String key, final String value) { if (key == null) { // this does nothing - return null; - } else if (value == null) { + return; + } + if (value == null) { // assigning the null value creates the same effect like removing the element - return super.remove(key); - } else { - return super.put(key, value); + map.getMap().remove(key); + return; + } + String[] a = map.getMap().get(key); + if (a == null) { + map.getMap().put(key, new String[]{value}); + return; + } + if (this.allowMultipleEntries) { + for (int i = 0; i < a.length; i++) { + if (a[i].equals(value)) return; + } + String[] aa = new String[a.length + 1]; + System.arraycopy(a, 0, aa, 0, a.length); + aa[a.length] = value; + map.getMap().put(key, aa); + return; } + map.getMap().put(key, new String[]{value}); } - public String put(final String key, final String[] values) { + public void put(final String key, final String[] values) { if (key == null) { // this does nothing - return null; + return; } else if (values == null) { // assigning the null value creates the same effect like removing the element - return super.remove(key); + map.getMap().remove(key); + return; } else { - StringBuilder sb = new StringBuilder(10 + values.length * 8); - for (String s: values) sb.append(s).append(' '); - return put(key, sb.toString().trim()); + map.getMap().put(key, values); } } @@ -155,12 +234,8 @@ public class serverObjects extends HashMap implements Cloneable if (key == null) { // this does nothing return; - } else if (value == null) { - // assigning the null value creates the same effect like removing the element - super.remove(key); - } else { - super.put(key, value.toString()); } + put(key, value.toString()); } /** @@ -169,9 +244,9 @@ public class serverObjects extends HashMap implements Cloneable * @param value mapped value as a byte array. * @return the previous value as String. */ - public String put(final String key, final byte[] value) { - if (value == null) return this.put(key, "NULL"); - return this.put(key, UTF8.String(value)); + public void put(final String key, final byte[] value) { + if (value == null) return; + put(key, UTF8.String(value)); } /** @@ -179,40 +254,37 @@ public class serverObjects extends HashMap implements Cloneable * to the map. * @param key key name as String. * @param value value as double/float. - * @return value as it was added to the map or NaN if an error occured. */ - public double put(final String key, final float value) { - return (null == this.put(key, Float.toString(value))) ? Float.NaN : value; + public void put(final String key, final float value) { + put(key, Float.toString(value)); } - public double put(final String key, final double value) { - return (null == this.put(key, Double.toString(value))) ? Double.NaN : value; + public void put(final String key, final double value) { + put(key, Double.toString(value)); } /** * same as {@link #put(String, double)} but for integer types - * @return Returns 0 for the error case. */ - public long put(final String key, final long value) { - return (null == this.put(key, Long.toString(value))) ? 0 : value; + public void put(final String key, final long value) { + put(key, Long.toString(value)); } - public String put(final String key, final java.util.Date value) { - return this.put(key, value.toString()); + public void put(final String key, final java.util.Date value) { + put(key, value.toString()); } - public String put(final String key, final InetAddress value) { - return this.put(key, value.toString()); + public void put(final String key, final InetAddress value) { + put(key, value.toString()); } /** * Add a String to the map. The content of the String is escaped to be usable in JSON output. * @param key key name as String. * @param value a String that will be reencoded for JSON output. - * @return the modified String that was added to the map. */ - public String putJSON(final String key, final String value) { - return put(key, toJSON(value)); + public void putJSON(final String key, final String value) { + put(key, toJSON(value)); } public static String toJSON(String value) { @@ -234,12 +306,12 @@ public class serverObjects extends HashMap implements Cloneable * @return the modified String that was added to the map. * @see CharacterCoding#encodeUnicode2html(String, boolean) */ - public String putHTML(final String key, final String value) { - return put(key, CharacterCoding.unicode2html(value, true)); + public void putHTML(final String key, final String value) { + put(key, CharacterCoding.unicode2html(value, true)); } - public String putHTML(final String key, final byte[] value) { - return putHTML(key, UTF8.String(value)); + public void putHTML(final String key, final byte[] value) { + putHTML(key, UTF8.String(value)); } /** @@ -248,8 +320,8 @@ public class serverObjects extends HashMap implements Cloneable * If forXML is true, then only the characters & " < > will be * replaced in the returned String. */ - public String putXML(final String key, final String value) { - return put(key, CharacterCoding.unicode2xml(value, true)); + public void putXML(final String key, final String value) { + put(key, CharacterCoding.unicode2xml(value, true)); } /** @@ -259,10 +331,10 @@ public class serverObjects extends HashMap implements Cloneable * @param value * @return */ - public String put(final RequestHeader.FileType fileType, final String key, final String value) { - if (fileType == FileType.JSON) return putJSON(key, value); - if (fileType == FileType.XML) return putXML(key, value); - return putHTML(key, value); + public void put(final RequestHeader.FileType fileType, final String key, final String value) { + if (fileType == FileType.JSON) putJSON(key, value); + else if (fileType == FileType.XML) putXML(key, value); + else putHTML(key, value); } /** @@ -273,62 +345,71 @@ public class serverObjects extends HashMap implements Cloneable * representation. * @return the String value added to the map. */ - public String putNum(final String key, final long value) { - return this.put(key, Formatter.number(value, this.localized)); + public void putNum(final String key, final long value) { + this.put(key, Formatter.number(value, this.localized)); } /** * Variant for double/float types. * @see #putNum(String, long) */ - public String putNum(final String key, final double value) { - return this.put(key, Formatter.number(value, this.localized)); + public void putNum(final String key, final double value) { + this.put(key, Formatter.number(value, this.localized)); } /** * Variant for string encoded numbers. * @see #putNum(String, long) */ - public String putNum(final String key, final String value) { - return this.put(key, value == null ? "" : Formatter.number(value)); + public void putNum(final String key, final String value) { + this.put(key, value == null ? "" : Formatter.number(value)); } - public String putWiki(final String hostport, final String key, final String wikiCode){ - return this.put(key, Switchboard.wikiParser.transform(hostport, wikiCode)); + public void putWiki(final String hostport, final String key, final String wikiCode){ + this.put(key, Switchboard.wikiParser.transform(hostport, wikiCode)); } - public String putWiki(final String hostport, final String key, final byte[] wikiCode) { + public void putWiki(final String hostport, final String key, final byte[] wikiCode) { try { - return this.put(key, Switchboard.wikiParser.transform(hostport, wikiCode)); + this.put(key, Switchboard.wikiParser.transform(hostport, wikiCode)); } catch (final UnsupportedEncodingException e) { - return this.put(key, "Internal error pasting wiki-code: " + e.getMessage()); + this.put(key, "Internal error pasting wiki-code: " + e.getMessage()); } } // inc variant: for counters public long inc(final String key) { - String c = super.get(key); + String c = get(key); if (c == null) c = "0"; final long l = Long.parseLong(c) + 1; - super.put(key, Long.toString(l)); + put(key, Long.toString(l)); return l; } + public String[] getParams(String name) { + return map.getMap().get(name); + } + + public String get(String name) { + String[] arr = map.getMap().get(name); + return arr==null ? null : arr[0]; + } + // new get with default objects public Object get(final String key, final Object dflt) { - final Object result = super.get(key); + final Object result = get(key); return (result == null) ? dflt : result; } // string variant public String get(final String key, final String dflt) { - final String result = removeByteOrderMark(super.get(key)); + final String result = removeByteOrderMark(get(key)); return (result == null) ? dflt : result; } public int getInt(final String key, final int dflt) { - final String s = removeByteOrderMark(super.get(key)); + final String s = removeByteOrderMark(get(key)); if (s == null) return dflt; try { return Integer.parseInt(s); @@ -338,7 +419,7 @@ public class serverObjects extends HashMap implements Cloneable } public long getLong(final String key, final long dflt) { - final String s = removeByteOrderMark(super.get(key)); + final String s = removeByteOrderMark(get(key)); if (s == null) return dflt; try { return Long.parseLong(s); @@ -348,7 +429,7 @@ public class serverObjects extends HashMap implements Cloneable } public float getFloat(final String key, final float dflt) { - final String s = removeByteOrderMark(super.get(key)); + final String s = removeByteOrderMark(get(key)); if (s == null) return dflt; try { return Float.parseFloat(s); @@ -358,7 +439,7 @@ public class serverObjects extends HashMap implements Cloneable } public double getDouble(final String key, final double dflt) { - final String s = removeByteOrderMark(super.get(key)); + final String s = removeByteOrderMark(get(key)); if (s == null) return dflt; try { return Double.parseDouble(s); @@ -368,7 +449,7 @@ public class serverObjects extends HashMap implements Cloneable } public boolean getBoolean(final String key) { - String s = removeByteOrderMark(super.get(key)); + String s = removeByteOrderMark(get(key)); if (s == null) return false; s = s.toLowerCase(); return s.equals("true") || s.equals("on") || s.equals("1"); @@ -433,7 +514,7 @@ public class serverObjects extends HashMap implements Cloneable @Override public Object clone() { - return super.clone(); + return new serverObjects(this.map.getMap()); } /** @@ -441,8 +522,8 @@ public class serverObjects extends HashMap implements Cloneable */ @Override public String toString() { - if (isEmpty()) return ""; - final StringBuilder param = new StringBuilder(size() * 40); + if (this.map.getMap().isEmpty()) return ""; + final StringBuilder param = new StringBuilder(this.map.getMap().size() * 40); for (final Map.Entry entry: entrySet()) { param.append(MultiProtocolURI.escape(entry.getKey())) .append('=') @@ -459,18 +540,12 @@ public class serverObjects extends HashMap implements Cloneable if (!this.containsKey(CommonParams.START)) this.put(CommonParams.START, "0"); // set default start item if (!this.containsKey(CommonParams.ROWS)) this.put(CommonParams.ROWS, "10"); // set default number of search results - Map m = new HashMap(); - for (Map.Entry e: this.entrySet()) { - m.put(e.getKey(), new String[]{e.getValue()}); - } if (facets != null && facets.length > 0) { - m.put("facet", new String[]{"true"}); - String[] fs = new String[facets.length]; - for (int i = 0; i < facets.length; i++) fs[i] = facets[i].getSolrFieldName(); - m.put("facet.field", fs); + this.remove("facet"); + this.put("facet", "true"); + for (int i = 0; i < facets.length; i++) this.put("facet.field", facets[i].getSolrFieldName()); } - final SolrParams solrParams = new MultiMapSolrParams(m); - return solrParams; + return this.map; } public static void main(final String[] args) { diff --git a/source/net/yacy/server/servletProperties.java b/source/net/yacy/server/servletProperties.java index 26e62dc54..2fc3542c3 100644 --- a/source/net/yacy/server/servletProperties.java +++ b/source/net/yacy/server/servletProperties.java @@ -59,13 +59,13 @@ public class servletProperties extends serverObjects { } @Override - public String put(final String key, final byte[] value) { - return super.put(this.prefix + key, value); + public void put(final String key, final byte[] value) { + super.put(this.prefix + key, value); } @Override - public long put(final String key, final long value) { - return super.put(this.prefix + key, value); + public void put(final String key, final long value) { + super.put(this.prefix + key, value); } @Override