From dc06e407ce6670de919e08d5f8fccaa079548c2e Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Thu, 23 Jan 2014 17:14:13 +0100 Subject: [PATCH] added two virtual instances of solr for the both cores: collection1 and webgraph. These cores are now accessible at /solr/collection1/select instead /solr/select?core=collection1 and /solr/webgraph/select instead /solr/select?core=webgraph in addition to the old behavior to support compatibility to the old peers. These new paths are fully solr standard-conform and will allow the cross-linking between YaCy peers using their public solr API. --- source/net/yacy/http/Jetty8HttpServerImpl.java | 4 +++- source/net/yacy/http/servlets/SolrServlet.java | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/net/yacy/http/Jetty8HttpServerImpl.java b/source/net/yacy/http/Jetty8HttpServerImpl.java index 7bea55583..bd6752d07 100644 --- a/source/net/yacy/http/Jetty8HttpServerImpl.java +++ b/source/net/yacy/http/Jetty8HttpServerImpl.java @@ -134,7 +134,9 @@ public class Jetty8HttpServerImpl implements YaCyHttpServer { htrootContext.addServlet(sholder,"/*"); //add SolrServlet - htrootContext.addServlet(SolrServlet.class,"/solr/select"); + htrootContext.addServlet(SolrServlet.class, "/solr/select"); // uses the default core, collection1 + htrootContext.addServlet(SolrServlet.class, "/solr/collection1/select"); // the same servlet, identifies the collection1 core using the path + htrootContext.addServlet(SolrServlet.class, "/solr/webgraph/select"); // the same servlet, identifies the webgraph core using the path // add proxy?url= servlet htrootContext.addServlet(YaCyProxyServlet.class,"/proxy.html"); diff --git a/source/net/yacy/http/servlets/SolrServlet.java b/source/net/yacy/http/servlets/SolrServlet.java index f66d0f234..75d8017ae 100644 --- a/source/net/yacy/http/servlets/SolrServlet.java +++ b/source/net/yacy/http/servlets/SolrServlet.java @@ -192,7 +192,8 @@ public class SolrServlet extends HttpServlet { } // get the embedded connector - boolean defaultConnector = mmsp.get("core", CollectionSchema.CORE_NAME).equals(CollectionSchema.CORE_NAME); + String requestURI = hrequest.getRequestURI(); + boolean defaultConnector = (requestURI.startsWith("/solr/" + WebgraphSchema.CORE_NAME)) ? false : requestURI.startsWith("/solr/" + CollectionSchema.CORE_NAME) || mmsp.get("core", CollectionSchema.CORE_NAME).equals(CollectionSchema.CORE_NAME); mmsp.getMap().remove("core"); EmbeddedSolrConnector connector = defaultConnector ? sb.index.fulltext().getDefaultEmbeddedConnector() : sb.index.fulltext().getEmbeddedConnector(WebgraphSchema.CORE_NAME); if (connector == null) throw new ServletException("no core");