fix for bad json

pull/93/head
Michael Peter Christen 9 years ago
parent 8f4a341735
commit db6d8fc197

@ -349,7 +349,7 @@ public class OpensearchResponseWriter implements QueryResponseWriter {
for (String s: snippets) {
if ((l == null || s.length() > l.length()) && s.indexOf(' ') > 0) l = s;
}
return l;
return l.replaceAll("\"", "'");
}
public static void openTag(final Writer writer, final String tag) throws IOException {

@ -203,7 +203,7 @@ public class YJsonResponseWriter implements QueryResponseWriter {
// compute snippet from texts
solitaireTag(writer, "path", path.toString());
solitaireTag(writer, "title", title.length() == 0 ? path.toString() : title);
solitaireTag(writer, "title", title.length() == 0 ? path.toString() : title.replaceAll("\"", "'"));
LinkedHashSet<String> snippet = urlhash == null ? null : snippets.get(urlhash);
if (snippet == null) {snippet = new LinkedHashSet<>(); snippet.addAll(descriptions);}
OpensearchResponseWriter.removeSubsumedTitle(snippet, title);
@ -293,7 +293,8 @@ public class YJsonResponseWriter implements QueryResponseWriter {
writer.write('"'); writer.write(tagname); writer.write("\":\""); writer.write(serverObjects.toJSON(value)); writer.write("\","); writer.write('\n');
}
private static void facetEntry(final Writer writer, final String modifier, final String propname, String value) throws IOException {
private static void facetEntry(final Writer writer, final String modifier, String propname, String value) throws IOException {
propname = propname.replaceAll("\"", "'");
writer.write("{\"name\": \""); writer.write(propname);
writer.write("\", \"count\": \""); writer.write(value);
writer.write("\", \"modifier\": \""); writer.write(modifier); writer.write("%3A"); writer.write(propname);

Loading…
Cancel
Save