set the title every time, it is possible that it has changed

pull/1/head
Michael Peter Christen 13 years ago
parent dcc72799c4
commit 24462e9baa

@ -38,6 +38,7 @@ public class select {
try {solrServlet.init(null);} catch (ServletException e) {}
RESPONSE_WRITER.putAll(SolrCore.DEFAULT_RESPONSE_WRITERS);
RESPONSE_WRITER.put("exml", new EnhancedXMLResponseWriter());
RESPONSE_WRITER.put("rss", new OpensearchResponseWriter()); //try http://localhost:8090/solr/select?wt=rss&q=olympia
}
/**
@ -91,15 +92,14 @@ public class select {
// get a response writer for the result
String wt = post.get("wt", "xml"); // maybe use /solr/select?q=*:*&start=0&rows=10&wt=exml
QueryResponseWriter responseWriter = RESPONSE_WRITER.get(wt);
if (responseWriter == null) {
if (RESPONSE_WRITER.get("rss") == null) {
final String promoteSearchPageGreeting =
(env.getConfigBool(SwitchboardConstants.GREETING_NETWORK_NAME, false)) ? env.getConfig(
"network.unit.description",
"") : env.getConfig(SwitchboardConstants.GREETING, "");
RESPONSE_WRITER.put("rss", new OpensearchResponseWriter(promoteSearchPageGreeting));
responseWriter = RESPONSE_WRITER.get(wt); //try http://localhost:8090/solr/select?wt=rss&q=olympia
}
if (responseWriter == null) return null;
if (responseWriter instanceof OpensearchResponseWriter) {
// set the title every time, it is possible that it has changed
final String promoteSearchPageGreeting =
(env.getConfigBool(SwitchboardConstants.GREETING_NETWORK_NAME, false)) ? env.getConfig(
"network.unit.description",
"") : env.getConfig(SwitchboardConstants.GREETING, "");
((OpensearchResponseWriter) responseWriter).setTitle(promoteSearchPageGreeting);
}
// write the result directly to the output stream

@ -58,7 +58,7 @@ public class OpensearchResponseWriter implements QueryResponseWriter {
private static final char[] XML_STOP = "</rss>\n".toCharArray();
private static final Set<String> DEFAULT_FIELD_LIST = null;
private final String title;
private String title;
private static class ResHead {
public int offset, rows, numFound;
@ -67,8 +67,11 @@ public class OpensearchResponseWriter implements QueryResponseWriter {
//public float maxScore;
}
public OpensearchResponseWriter(String searchPageTitle) {
public OpensearchResponseWriter() {
super();
}
public void setTitle(String searchPageTitle) {
this.title = searchPageTitle;
}

Loading…
Cancel
Save