|
|
|
@ -48,9 +48,11 @@ import net.yacy.cora.federate.solr.responsewriter.HTMLResponseWriter;
|
|
|
|
|
import net.yacy.cora.federate.solr.responsewriter.OpensearchResponseWriter;
|
|
|
|
|
import net.yacy.cora.federate.solr.responsewriter.YJsonResponseWriter;
|
|
|
|
|
import net.yacy.cora.util.ConcurrentLog;
|
|
|
|
|
import net.yacy.search.Switchboard;
|
|
|
|
|
import net.yacy.search.query.AccessTracker;
|
|
|
|
|
import net.yacy.search.query.SearchEvent;
|
|
|
|
|
import net.yacy.search.schema.CollectionSchema;
|
|
|
|
|
import net.yacy.search.schema.WebgraphSchema;
|
|
|
|
|
import org.apache.solr.common.SolrDocumentList;
|
|
|
|
|
|
|
|
|
|
import org.apache.solr.common.SolrException;
|
|
|
|
@ -76,10 +78,6 @@ public class SolrServlet implements Filter {
|
|
|
|
|
public SolrServlet() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void initCore(EmbeddedSolrConnector c) {
|
|
|
|
|
connector = c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void init(FilterConfig config) throws ServletException {
|
|
|
|
|
|
|
|
|
@ -134,15 +132,22 @@ public class SolrServlet implements Filter {
|
|
|
|
|
throw new ServletException("Unsupported method: " + hrequest.getMethod());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// prepare request to solr
|
|
|
|
|
MultiMapSolrParams mmsp = SolrRequestParsers.parseQueryString(hrequest.getQueryString());
|
|
|
|
|
String corename = mmsp.get("core",CollectionSchema.CORE_NAME);
|
|
|
|
|
|
|
|
|
|
// get the embedded connector
|
|
|
|
|
boolean defaultConnector = corename.equals(CollectionSchema.CORE_NAME);
|
|
|
|
|
connector = defaultConnector ? Switchboard.getSwitchboard().index.fulltext().getDefaultEmbeddedConnector() : Switchboard.getSwitchboard().index.fulltext().getEmbeddedConnector(WebgraphSchema.CORE_NAME);
|
|
|
|
|
|
|
|
|
|
SolrCore core = connector.getCore();
|
|
|
|
|
if (core == null) {
|
|
|
|
|
hresponse.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "core not initialized");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// prepare request to solr
|
|
|
|
|
hrequest.setAttribute("org.apache.solr.CoreContainer", core);
|
|
|
|
|
MultiMapSolrParams mmsp = SolrRequestParsers.parseQueryString(hrequest.getQueryString());
|
|
|
|
|
String wt = mmsp.get(CommonParams.WT, "xml"); // maybe use /solr/select?q=*:*&start=0&rows=10&wt=exml
|
|
|
|
|
QueryResponseWriter responseWriter = RESPONSE_WRITER.get(wt); // check local response writer
|
|
|
|
|
if (responseWriter == null) {
|
|
|
|
|