Modified: lucene/solr/trunk/src/webapp/resources/admin/_info.jsp URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/_info.jsp?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/_info.jsp (original) +++ lucene/solr/trunk/src/webapp/resources/admin/_info.jsp Thu Dec 6 19:49:52 2007 @@ -24,9 +24,17 @@ <%@ page import="org.apache.solr.util.XML"%> <%@ page import="org.apache.lucene.LucenePackage"%> + <% - Object ocore = request.getAttribute("org.apache.solr.SolrCore"); - SolrCore core = ocore instanceof SolrCore? (SolrCore) ocore : SolrCore.getSolrCore(); + // + SolrCore core = (SolrCore) request.getAttribute("org.apache.solr.SolrCore"); + if (core == null) { + String coreParam = request.getParameter("core"); + core = coreParam != null? org.apache.solr.core.MultiCore.getRegistry().getCore(coreParam) : null; + } + if (core == null) + core = SolrCore.getSolrCore(); + SolrConfig solrConfig = core.getSolrConfig(); int port = request.getServerPort(); IndexSchema schema = core.getSchema();
Modified: lucene/solr/trunk/src/webapp/resources/admin/action.jsp URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/action.jsp?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/action.jsp (original) +++ lucene/solr/trunk/src/webapp/resources/admin/action.jsp Thu Dec 6 19:49:52 2007 @@ -111,6 +111,6 @@ </tr> </table> <br><br> - <a href=".">Return to Admin Page</a> + <a href=".?core=<%=core.getName()%>">Return to Admin Page</a> </body> </html> Modified: lucene/solr/trunk/src/webapp/resources/admin/analysis.jsp URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/analysis.jsp?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/analysis.jsp (original) +++ lucene/solr/trunk/src/webapp/resources/admin/analysis.jsp Thu Dec 6 19:49:52 2007 @@ -60,6 +60,7 @@ <h2>Field Analysis</h2> <form method="GET" action="analysis.jsp"> +<input type='hidden' name='core' value='<%=core.getName()%>'> <table> <tr> <td> Modified: lucene/solr/trunk/src/webapp/resources/admin/distributiondump.jsp URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/distributiondump.jsp?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/distributiondump.jsp (original) +++ lucene/solr/trunk/src/webapp/resources/admin/distributiondump.jsp Thu Dec 6 19:49:52 2007 @@ -153,6 +153,6 @@ <%= buffer %> </table> <br><br> - <a href=".">Return to Admin Page</a> + <a href=".?<%=core.getName()%>">Return to Admin Page</a> </body> </html> Modified: lucene/solr/trunk/src/webapp/resources/admin/form.jsp URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/form.jsp?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/form.jsp (original) +++ lucene/solr/trunk/src/webapp/resources/admin/form.jsp Thu Dec 6 19:49:52 2007 @@ -19,7 +19,7 @@ <br clear="all"> <form name="queryForm" method="GET" action="../select"> - +<input name='core' type='hidden' value='<%=core.getName()%>'> <!-- these are good defaults to have if people bookmark the resulting URLs, but they should not show up in the form since they are very output type specific. Modified: lucene/solr/trunk/src/webapp/resources/admin/header.jsp URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/header.jsp?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/header.jsp (original) +++ lucene/solr/trunk/src/webapp/resources/admin/header.jsp Thu Dec 6 19:49:52 2007 @@ -29,7 +29,7 @@ </head> <body> -<a href="."><img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="Solr"></a> +<a href="?core=<%=core.getName()%>"><img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="Solr"></a> <h1>Solr Admin (<%= collectionName %>) <%= enabledStatus==null ? "" : (isEnabled ? " - Enabled" : " - Disabled") %> </h1> Modified: lucene/solr/trunk/src/webapp/resources/admin/index.jsp URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/index.jsp?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/index.jsp (original) +++ lucene/solr/trunk/src/webapp/resources/admin/index.jsp Thu Dec 6 19:49:52 2007 @@ -34,42 +34,53 @@ <h3>Solr</h3> </td> <td> - [<a href="get-file.jsp?file=<%=core.getSchemaFile()%>">Schema</a>] - [<a href="get-file.jsp?file=<%=core.getConfigFile()%>">Config</a>] - [<a href="analysis.jsp?highlight=on">Analysis</a>] + [<a href="get-file.jsp?core=<%=core.getName()%>&file=<%=core.getSchemaFile()%>">Schema</a>] + [<a href="get-file.jsp?core=<%=core.getName()%>&file=<%=core.getConfigFile()%>">Config</a>] + [<a href="analysis.jsp?core=<%=core.getName()%>&highlight=on">Analysis</a>] <br> - [<a href="stats.jsp">Statistics</a>] - [<a href="registry.jsp">Info</a>] - [<a href="distributiondump.jsp">Distribution</a>] - [<a href="ping">Ping</a>] - [<a href="logging.jsp">Logging</a>] + [<a href="stats.jsp?core=<%=core.getName()%>">Statistics</a>] + [<a href="registry.jsp?core=<%=core.getName()%>">Info</a>] + [<a href="distributiondump.jsp?core=<%=core.getName()%>">Distribution</a>] + [<a href="ping?core=<%=core.getName()%>">Ping</a>] + [<a href="logging.jsp?core=<%=core.getName()%>">Logging</a>] </td> </tr> +<%-- List the cores (that arent this one) so we can switch --%> +<% java.util.Collection<SolrCore> cores = org.apache.solr.core.MultiCore.getRegistry().getCores(); +if (cores.size() > 1) {%><tr><td><strong>Cores:</strong><br></td><td><% + java.util.Iterator<SolrCore> icore = cores.iterator(); + while (icore.hasNext()) { + SolrCore acore = icore.next(); + if (acore == core) continue; + %>[<a href=".?core=<%=acore.getName()%>"><%=acore.getName()%></a>]<% + }%></td></tr><% +}%> <tr> <td> <strong>App server:</strong><br> </td> <td> - [<a href="get-properties.jsp">Java Properties</a>] - [<a href="threaddump.jsp">Thread Dump</a>] + [<a href="get-properties.jsp?core=<%=core.getName()%>">Java Properties</a>] + [<a href="threaddump.jsp?core=<%=core.getName()%>">Thread Dump</a>] <% if (enabledFile!=null) if (isEnabled) { %> - [<a href="action.jsp?action=Disable">Disable</a>] + [<a href="action.jsp?core=<%=core.getName()%>&action=Disable">Disable</a>] <% } else { %> - [<a href="action.jsp?action=Enable">Enable</a>] + [<a href="action.jsp?core=<%=core.getName()%>&action=Enable">Enable</a>] <% } %> </td> </tr> -<jsp:include page="get-file.jsp?file=admin-extra.html&optional=y" flush="true"/> + +<jsp:include page="get-file.jsp?core=<%=core.getName()%>&file=admin-extra.html&optional=y" flush="true"/> </table><P> @@ -80,7 +91,7 @@ <h3>Make a Query</h3> </td> <td> -[<a href="form.jsp">Full Interface</a>] +[<a href="form.jsp?core=<%=core.getName()%>">Full Interface</a>] </td> </tr> @@ -91,6 +102,7 @@ <td colspan=2> <form name=queryForm method="GET" action="../select/"> <textarea class="std" rows="4" cols="40" name="q"><%= defaultSearch %></textarea> + <input name="core" type="hidden" value="<%=core.getName()%>"> <input name="version" type="hidden" value="2.2"> <input name="start" type="hidden" value="0"> <input name="rows" type="hidden" value="10"> Modified: lucene/solr/trunk/src/webapp/resources/admin/logging.jsp URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/logging.jsp?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/logging.jsp (original) +++ lucene/solr/trunk/src/webapp/resources/admin/logging.jsp Thu Dec 6 19:49:52 2007 @@ -28,6 +28,14 @@ <?xml-stylesheet type="text/xsl" href="logging.xsl"?> <% + SolrCore core = (SolrCore) request.getAttribute("org.apache.solr.SolrCore"); + if (core == null) { + String coreParam = request.getParameter("core"); + core = coreParam != null? org.apache.solr.core.MultiCore.getRegistry().getCore(coreParam) : null; + } + if (core == null) + core = SolrCore.getSolrCore(); + Logger log = SolrCore.log; Logger parent = log.getParent(); while(parent != null) { @@ -38,6 +46,7 @@ %> <solr> + <core><%=core.getName()%></core> <logging> <% if (lvl != null) {%> <logLevel><%= lvl.toString() %></logLevel> Modified: lucene/solr/trunk/src/webapp/resources/admin/logging.xsl URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/logging.xsl?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/logging.xsl (original) +++ lucene/solr/trunk/src/webapp/resources/admin/logging.xsl Thu Dec 6 19:49:52 2007 @@ -1,89 +1,119 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<!-- $Id$ --> -<!-- $URL$ --> - -<xsl:stylesheet - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - version="1.0"> - - <xsl:output - method="html" - indent="yes" - doctype-public="-//W3C//DTD HTML 4.01//EN" - doctype-system="http://www.w3.org/TR/html4/strict.dtd" /> - - <xsl:template match="/"> - <html> - <head> - <link rel="stylesheet" type="text/css" href="solr-admin.css"></link> - <link rel="icon" href="/favicon.ico" type="image/ico"></link> - <link rel="shortcut icon" href="/favicon.ico" type="image/ico"></link> - <title>Solr Admin: Logging</title> - </head> - <body> - <a href=""> - <img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="SOLR"> - </img> - </a> - <h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1> - <div style="margin-top: 1em;"> - <xsl:apply-templates/> - <div> - </div> - <a href=".">Return to Admin Page</a> - </div> - </body> - </html> - </xsl:template> - - <xsl:include href="meta.xsl"/> - - <xsl:template match="solr/logging"> - -<br clear="all"/> -<h2>Solr Logging</h2> -<table> - <tr> - <td> - <H3>Log Level:</H3> - </td> - <td> -<xsl:value-of select="logLevel" /> - </td> - </tr> - <tr> - <td> - Set Level - </td> - <td> - [<a href="action.jsp?log=ALL">ALL</a>] - [<a href="action.jsp?log=CONFIG">CONFIG</a>] - [<a href="action.jsp?log=FINE">FINE</a>] - [<a href="action.jsp?log=FINER">FINER</a>] - [<a href="action.jsp?log=FINEST">FINEST</a>] - [<a href="action.jsp?log=INFO">INFO</a>] - [<a href="action.jsp?log=OFF">OFF</a>] - [<a href="action.jsp?log=SEVERE">SEVERE</a>] - [<a href="action.jsp?log=WARNING">WARNING</a>] - </td> - </tr> -</table> - - </xsl:template> -</xsl:stylesheet> +<?xml version="1.0" encoding="utf-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- $Id$ --> +<!-- $URL$ --> + +<xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + + <xsl:output + method="html" + indent="yes" + doctype-public="-//W3C//DTD HTML 4.01//EN" + doctype-system="http://www.w3.org/TR/html4/strict.dtd" /> + + <xsl:template match="/"> + <html> + <head> + <link rel="stylesheet" type="text/css" href="solr-admin.css"></link> + <link rel="icon" href="/favicon.ico" type="image/ico"></link> + <link rel="shortcut icon" href="/favicon.ico" type="image/ico"></link> + <title>Solr Admin: Logging</title> + </head> + <body> + <a href=""> + <img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="SOLR"> + </img> + </a> + <h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1> + <div style="margin-top: 1em;"> + <xsl:apply-templates/> + <div> + </div> + <xsl:element name='a'> + <xsl:attribute name='href'>.?core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>Return to Admin Page</xsl:text> + </xsl:element> + </div> + </body> + </html> + </xsl:template> + + <xsl:include href="meta.xsl"/> + + <xsl:template match="solr/logging"> + +<br clear="all"/> +<h2>Solr Logging</h2> +<table> + <tr> + <td> + <H3>Log Level:</H3> + </td> + <td> +<xsl:value-of select="logLevel" /> + </td> + </tr> + <tr> + <td> + Set Level + </td> + <td> + [<xsl:element name='a'> + <xsl:attribute name='href'>action.jsp?log=ALL&core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>ALL</xsl:text> + </xsl:element>] + [<xsl:element name='a'> + <xsl:attribute name='href'>action.jsp?log=CONFIG&core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>CONFIG</xsl:text> + </xsl:element>] + [<xsl:element name='a'> + <xsl:attribute name='href'>action.jsp?log=FINE&core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>FINE</xsl:text> + </xsl:element>] + [<xsl:element name='a'> + <xsl:attribute name='href'>action.jsp?log=FINER&core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>FINER</xsl:text> + </xsl:element>] + [<xsl:element name='a'> + <xsl:attribute name='href'>action.jsp?log=FINEST&core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>FINEST</xsl:text> + </xsl:element>] + [<xsl:element name='a'> + <xsl:attribute name='href'>action.jsp?log=INFO&core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>INFO</xsl:text> + </xsl:element>] + [<xsl:element name='a'> + <xsl:attribute name='href'>action.jsp?log=OFF&core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>OFF</xsl:text> + </xsl:element>] + [<xsl:element name='a'> + <xsl:attribute name='href'>action.jsp?log=SEVERE&core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>SEVERE</xsl:text> + </xsl:element>] + [<xsl:element name='a'> + <xsl:attribute name='href'>action.jsp?log=WARNING&core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>WARNING</xsl:text> + </xsl:element>] + </td> + </tr> +</table> + + </xsl:template> +</xsl:stylesheet> Modified: lucene/solr/trunk/src/webapp/resources/admin/ping.jsp URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/ping.jsp?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/ping.jsp (original) +++ lucene/solr/trunk/src/webapp/resources/admin/ping.jsp Thu Dec 6 19:49:52 2007 @@ -24,26 +24,22 @@ <%@ page import="org.apache.solr.request.ServletSolrParams"%> <%@ page import="org.apache.solr.request.SolrQueryRequest"%> +<% + SolrCore core = (SolrCore) request.getAttribute("org.apache.solr.SolrCore"); + if (core == null) { + String coreParam = request.getParameter("core"); + core = coreParam != null? org.apache.solr.core.MultiCore.getRegistry().getCore(coreParam) : null; + } + if (core == null) + core = SolrCore.getSolrCore(); +%> <?xml-stylesheet type="text/xsl" href="ping.xsl"?> <solr> + <core><%=core.getName()%></core> <ping> <% -// -// Deprecated -- use PingRequestHandler -// - - Object ocore = request.getAttribute("org.apache.solr.SolrCore"); - SolrCore core = ocore instanceof SolrCore? (SolrCore) ocore : SolrCore.getSolrCore(); - - SolrQueryRequest req = null; - - if (null == request.getQueryString()) { - req = core.getPingQueryRequest(); - } else { - req = new LocalSolrQueryRequest(core, new ServletSolrParams(request)); - } - + SolrQueryRequest req = core.getPingQueryRequest(); SolrQueryResponse resp = new SolrQueryResponse(); try { core.execute(req,resp); Modified: lucene/solr/trunk/src/webapp/resources/admin/ping.xsl URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/ping.xsl?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/ping.xsl (original) +++ lucene/solr/trunk/src/webapp/resources/admin/ping.xsl Thu Dec 6 19:49:52 2007 @@ -1,69 +1,72 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<!-- $Id$ --> -<!-- $URL$ --> - -<xsl:stylesheet - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - version="1.0"> - - <xsl:output - method="html" - indent="yes" - doctype-public="-//W3C//DTD HTML 4.01//EN" - doctype-system="http://www.w3.org/TR/html4/strict.dtd" /> - - <xsl:template match="/"> - <html> - <head> - <link rel="stylesheet" type="text/css" href="solr-admin.css"></link> - <link rel="icon" href="/favicon.ico" type="image/ico"></link> - <link rel="shortcut icon" href="/favicon.ico" type="image/ico"></link> - <title>Solr Admin: Ping</title> - </head> - <body> - <a href=""> - <img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="SOLR"> - </img> - </a> - <h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1> - <div style="margin-top: 1em;"> - <xsl:apply-templates/> - <div> - </div> - <a href=".">Return to Admin Page</a> - </div> - </body> - </html> - </xsl:template> - - <xsl:include href="meta.xsl"/> - - <xsl:template match="solr/ping"> - <table> - <tr> - <td> - <H3>Ping</H3> - </td> - <td> - <xsl:value-of select="error" /> - </td> - </tr> - </table> - </xsl:template> -</xsl:stylesheet> +<?xml version="1.0" encoding="utf-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- $Id$ --> +<!-- $URL$ --> + +<xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + + <xsl:output + method="html" + indent="yes" + doctype-public="-//W3C//DTD HTML 4.01//EN" + doctype-system="http://www.w3.org/TR/html4/strict.dtd" /> + + <xsl:template match="/"> + <html> + <head> + <link rel="stylesheet" type="text/css" href="solr-admin.css"></link> + <link rel="icon" href="/favicon.ico" type="image/ico"></link> + <link rel="shortcut icon" href="/favicon.ico" type="image/ico"></link> + <title>Solr Admin: Ping</title> + </head> + <body> + <a href=""> + <img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="SOLR"> + </img> + </a> + <h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1> + <div style="margin-top: 1em;"> + <xsl:apply-templates/> + <div> + </div> + <xsl:element name='a'> + <xsl:attribute name='href'>.?core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>Return to Admin Page (ping)</xsl:text> + </xsl:element> + </div> + </body> + </html> + </xsl:template> + + <xsl:include href="meta.xsl"/> + + <xsl:template match="solr/ping"> + <table> + <tr> + <td> + <H3>Ping</H3> + </td> + <td> + <xsl:value-of select="error" /> + </td> + </tr> + </table> + </xsl:template> +</xsl:stylesheet> Modified: lucene/solr/trunk/src/webapp/resources/admin/raw-schema.jsp URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/raw-schema.jsp?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/raw-schema.jsp (original) +++ lucene/solr/trunk/src/webapp/resources/admin/raw-schema.jsp Thu Dec 6 19:49:52 2007 @@ -20,8 +20,14 @@ <%@ page import="java.io.Reader"%> <%@ page contentType="text/plain;charset=UTF-8" language="java" %> <% - Object ocore = request.getAttribute("org.apache.solr.SolrCore"); - SolrCore core = ocore instanceof SolrCore? (SolrCore) ocore : SolrCore.getSolrCore(); + SolrCore core = (SolrCore) request.getAttribute("org.apache.solr.SolrCore"); + if (core == null) { + String coreParam = request.getParameter("core"); + core = coreParam != null? org.apache.solr.core.MultiCore.getRegistry().getCore(coreParam) : null; + } + if (core == null) + core = SolrCore.getSolrCore(); + IndexSchema schema = core.getSchema(); Reader input = new InputStreamReader(schema.getInputStream()); char[] buf = new char[4096]; Modified: lucene/solr/trunk/src/webapp/resources/admin/registry.jsp URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/registry.jsp?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/registry.jsp (original) +++ lucene/solr/trunk/src/webapp/resources/admin/registry.jsp Thu Dec 6 19:49:52 2007 @@ -25,6 +25,7 @@ <[EMAIL PROTECTED] file="_info.jsp" %> <solr> + <core><%= core.getName()%></core> <schema><%= collectionName %></schema> <host><%= hostname %></host> <now><%= new Date().toString() %></now> Modified: lucene/solr/trunk/src/webapp/resources/admin/registry.xsl URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/registry.xsl?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/registry.xsl (original) +++ lucene/solr/trunk/src/webapp/resources/admin/registry.xsl Thu Dec 6 19:49:52 2007 @@ -48,7 +48,10 @@ <br clear="all" /> <xsl:apply-templates/> <br /><br /> - <a href="">Return to Admin Page</a> + <xsl:element name='a'> + <xsl:attribute name='href'>.?core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>Return to Admin Page</xsl:text> + </xsl:element> </body> </html> </xsl:template> Modified: lucene/solr/trunk/src/webapp/resources/admin/stats.jsp URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/stats.jsp?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/stats.jsp (original) +++ lucene/solr/trunk/src/webapp/resources/admin/stats.jsp Thu Dec 6 19:49:52 2007 @@ -25,6 +25,7 @@ <solr> + <core><%=core.getName()%></core> <schema><%= collectionName %></schema> <host><%= hostname %></host> <now><%= new Date().toString() %></now> Modified: lucene/solr/trunk/src/webapp/resources/admin/stats.xsl URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/stats.xsl?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/stats.xsl (original) +++ lucene/solr/trunk/src/webapp/resources/admin/stats.xsl Thu Dec 6 19:49:52 2007 @@ -48,7 +48,10 @@ <br clear="all" /> <xsl:apply-templates/> <br /><br /> - <a href=".">Return to Admin Page</a> + <xsl:element name='a'> + <xsl:attribute name='href'>.?core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>Return to Admin Page</xsl:text> + </xsl:element> </body> </html> </xsl:template> Modified: lucene/solr/trunk/src/webapp/resources/admin/threaddump.jsp URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/threaddump.jsp?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/threaddump.jsp (original) +++ lucene/solr/trunk/src/webapp/resources/admin/threaddump.jsp Thu Dec 6 19:49:52 2007 @@ -15,18 +15,28 @@ See the License for the specific language governing permissions and limitations under the License. --%> -<%@ page import="java.lang.management.ManagementFactory, +<%@ page import="org.apache.solr.core.SolrCore, + java.lang.management.ManagementFactory, java.lang.management.ThreadMXBean, java.lang.management.ThreadInfo, java.io.IOException, org.apache.solr.util.XML"%> <?xml-stylesheet type="text/xsl" href="threaddump.xsl"?> - +<% + SolrCore core = (SolrCore) request.getAttribute("org.apache.solr.SolrCore"); + if (core == null) { + String coreParam = request.getParameter("core"); + core = coreParam != null? org.apache.solr.core.MultiCore.getRegistry().getCore(coreParam) : null; + } + if (core == null) + core = SolrCore.getSolrCore(); +%> <%! static ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); %> <solr> + <core><%=core.getName()%></core> <system> <jvm> <version><%=System.getProperty("java.vm.version")%></version> Modified: lucene/solr/trunk/src/webapp/resources/admin/threaddump.xsl URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/resources/admin/threaddump.xsl?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/resources/admin/threaddump.xsl (original) +++ lucene/solr/trunk/src/webapp/resources/admin/threaddump.xsl Thu Dec 6 19:49:52 2007 @@ -1,101 +1,104 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<!-- $Id$ --> -<!-- $URL$ --> - -<xsl:stylesheet - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - version="1.0"> - - <xsl:output - method="html" - indent="yes" - doctype-public="-//W3C//DTD HTML 4.01//EN" - doctype-system="http://www.w3.org/TR/html4/strict.dtd" /> - - <xsl:template match="/"> - <html> - <head> - <link rel="stylesheet" type="text/css" href="solr-admin.css"></link> - <link rel="icon" href="/favicon.ico" type="image/ico"></link> - <link rel="shortcut icon" href="/favicon.ico" type="image/ico"></link> - <title>SOLR Info</title> - </head> - <body> - <a href=""> - <img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="SOLR"/> - </a> - <h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1> - <h2>Thread Dump</h2> - <div style="margin-top: 1em;"> - <table> - <xsl:apply-templates/> - </table> - <a href=".">Return to Admin Page</a> - </div> - </body> - </html> - </xsl:template> - - <xsl:include href="meta.xsl"/> - - <xsl:template match="solr/system/jvm"> - <tr> - <td><xsl:value-of select="name"/> <xsl:value-of select="version"/></td> - </tr> - </xsl:template> - - <xsl:template match="solr/system/threadCount"> - <tr> - <td> - Thread Count: - current=<xsl:value-of select="current"/>, - peak=<xsl:value-of select="peak"/>, - daemon=<xsl:value-of select="daemon"/></td> - </tr> - </xsl:template> - - <xsl:template match="solr/system/threadDump"> - <div>Full Thread Dump:</div> - <xsl:for-each select="thread"> - <!-- OG: TODO: add suspended/native conditionals --> - <tr> - <td style="margin-left: 1em; font-weight: bold;"> - '<xsl:value-of select="name"/>' - Id=<xsl:value-of select="id"/>, - <xsl:value-of select="state"/> - on lock=<xsl:value-of select="lock"/>, - total cpu time=<xsl:value-of select="cpuTime"/> - user time=<xsl:value-of select="userTime"/> - </td> - </tr> - <xsl:apply-templates select="stackTrace"/> - </xsl:for-each> - </xsl:template> - - <xsl:template match="stackTrace"> - <tr> - <td style="margin-left: 1em;"> - <xsl:for-each select="line"> - <xsl:value-of select="."/><br/> - </xsl:for-each> - </td> - </tr> - </xsl:template> - -</xsl:stylesheet> +<?xml version="1.0" encoding="utf-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- $Id$ --> +<!-- $URL$ --> + +<xsl:stylesheet + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + + <xsl:output + method="html" + indent="yes" + doctype-public="-//W3C//DTD HTML 4.01//EN" + doctype-system="http://www.w3.org/TR/html4/strict.dtd" /> + + <xsl:template match="/"> + <html> + <head> + <link rel="stylesheet" type="text/css" href="solr-admin.css"></link> + <link rel="icon" href="/favicon.ico" type="image/ico"></link> + <link rel="shortcut icon" href="/favicon.ico" type="image/ico"></link> + <title>SOLR Info</title> + </head> + <body> + <a href=""> + <img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="SOLR"/> + </a> + <h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1> + <h2>Thread Dump</h2> + <div style="margin-top: 1em;"> + <table> + <xsl:apply-templates/> + </table> + <xsl:element name='a'> + <xsl:attribute name='href'>.?core=<xsl:value-of select="//solr/core"/></xsl:attribute> + <xsl:text>Return to Admin Page</xsl:text> + </xsl:element> + </div> + </body> + </html> + </xsl:template> + + <xsl:include href="meta.xsl"/> + + <xsl:template match="solr/system/jvm"> + <tr> + <td><xsl:value-of select="name"/> <xsl:value-of select="version"/></td> + </tr> + </xsl:template> + + <xsl:template match="solr/system/threadCount"> + <tr> + <td> + Thread Count: + current=<xsl:value-of select="current"/>, + peak=<xsl:value-of select="peak"/>, + daemon=<xsl:value-of select="daemon"/></td> + </tr> + </xsl:template> + + <xsl:template match="solr/system/threadDump"> + <div>Full Thread Dump:</div> + <xsl:for-each select="thread"> + <!-- OG: TODO: add suspended/native conditionals --> + <tr> + <td style="margin-left: 1em; font-weight: bold;"> + '<xsl:value-of select="name"/>' + Id=<xsl:value-of select="id"/>, + <xsl:value-of select="state"/> + on lock=<xsl:value-of select="lock"/>, + total cpu time=<xsl:value-of select="cpuTime"/> + user time=<xsl:value-of select="userTime"/> + </td> + </tr> + <xsl:apply-templates select="stackTrace"/> + </xsl:for-each> + </xsl:template> + + <xsl:template match="stackTrace"> + <tr> + <td style="margin-left: 1em;"> + <xsl:for-each select="line"> + <xsl:value-of select="."/><br/> + </xsl:for-each> + </td> + </tr> + </xsl:template> + +</xsl:stylesheet> Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java (original) +++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java Thu Dec 6 19:49:52 2007 @@ -107,7 +107,7 @@ // If the Data directory is specified, initialize SolrCore directly IndexSchema schema = new IndexSchema(config, instanceDir+"/conf/schema.xml"); - core = new SolrCore( dataDir, config, schema ); + core = new SolrCore( "core", dataDir, config, schema ); parser = new SolrRequestParsers( true, Long.MAX_VALUE ); } catch (Exception ee) { Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java?rev=601975&r1=601974&r2=601975&view=diff ============================================================================== --- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java (original) +++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/SolrDispatchFilter.java Thu Dec 6 19:49:52 2007 @@ -17,6 +17,7 @@ package org.apache.solr.servlet; +import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; @@ -35,8 +36,10 @@ import org.apache.solr.common.SolrException; import org.apache.solr.common.params.CommonParams; import org.apache.solr.core.Config; +import org.apache.solr.core.MultiCore; import org.apache.solr.core.SolrConfig; import org.apache.solr.core.SolrCore; +import org.apache.solr.core.SolrResourceLoader; import org.apache.solr.request.QueryResponseWriter; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.request.SolrQueryResponse; @@ -49,7 +52,8 @@ { final Logger log = Logger.getLogger(SolrDispatchFilter.class.getName()); - protected SolrCore core; + protected SolrCore singlecore; + protected MultiCore multicore; protected SolrRequestParsers parsers; protected boolean handleSelect = false; protected String pathPrefix = null; // strip this from the beginning of a path @@ -64,10 +68,32 @@ // web.xml configuration this.pathPrefix = config.getInitParameter( "path-prefix" ); + // Find a valid solr core + SolrCore core = null; + multicore = MultiCore.getRegistry(); + String instanceDir = SolrResourceLoader.locateInstanceDir(); + File multiconfig = new File( instanceDir, "multicore.xml" ); + log.info( "looking for multicore.xml: "+multiconfig.getAbsolutePath() ); + if( multiconfig.exists() ) { + multicore.load( instanceDir, multiconfig ); + } + if( multicore.isEnabled() ) { + core = multicore.getDefaultCore(); + if( core == null ) { + throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, + "Multicore configuration does not include a default" ); + } + singlecore = null; + } + else { + singlecore = new SolrCore( null, null, new SolrConfig(), null ); + core = singlecore; + } + log.info("user.dir=" + System.getProperty("user.dir")); - core = SolrCore.getSolrCore(); - // Read the configuration + // Read global configuration + // Only the first registerd core configures the following attributes Config solrConfig = core.getSolrConfig(); long uploadLimitKB = solrConfig.getInt( @@ -120,7 +146,10 @@ } public void destroy() { - core.close(); + multicore.shutdown(); + if( singlecore != null ) { + singlecore.close(); + } } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException @@ -149,6 +178,32 @@ path = path.substring( 0, idx ); } + // By default use the single core. If multicore is enabled, look for one. + SolrCore core = singlecore; + if( core == null ) { + // try to get the corename as a request parameter first + String corename = request.getParameter("core"); + if( corename == null && path.startsWith( "/@" ) ) { // multicore + idx = path.indexOf( '/', 2 ); + if( idx < 1 ) { + throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, + "MultiCore path must contain a '/'. For example: /@corename/handlerpath" ); + } + corename = path.substring( 2, idx ); + path = path.substring( idx ); + } + if (corename != null) { + core = multicore.getCore( corename ); + if( core == null ) { + throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, + "Can not find core: '"+corename+"'" ); + } + } + else { + core = multicore.getDefaultCore(); + } + } + SolrRequestHandler handler = null; if( path.length() > 1 ) { // don't match "" or "/" as valid path handler = core.getRequestHandler( path ); @@ -166,6 +221,12 @@ } } } + + // Perhaps this is a muli-core admin page? + if( handler == null && path.equals( multicore.getAdminPath() ) ) { + handler = multicore.getMultiCoreHandler(); + } + if( handler != null ) { if( solrReq == null ) { solrReq = parsers.parse( core, path, req ); @@ -184,6 +245,11 @@ responseWriter.write(out, solrReq, solrRsp); return; } + // otherwise, let's ensure the core is in the SolrCore request attribute so + // the servlet can retrieve it + else { + req.setAttribute("org.apache.solr.SolrCore", core); + } } catch( Throwable ex ) { sendError( (HttpServletResponse)response, ex ); @@ -203,7 +269,7 @@ protected void execute( HttpServletRequest req, SolrRequestHandler handler, SolrQueryRequest sreq, SolrQueryResponse rsp) { // a custom filter could add more stuff to the request before passing it on. // for example: sreq.getContext().put( "HttpServletRequest", req ); - core.execute( handler, sreq, rsp ); + sreq.getCore().execute( handler, sreq, rsp ); } protected void sendError(HttpServletResponse res, Throwable ex) throws IOException
