mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Clean solr webapps commit
This commit is contained in:
148
webapp/src/main/webapp/WEB-INF/web.xml
Normal file
148
webapp/src/main/webapp/WEB-INF/web.xml
Normal file
@@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<web-app>
|
||||
|
||||
<!-- Uncomment if you are trying to use a Resin version before 3.0.19.
|
||||
Their XML implementation isn't entirely compatible with Xerces.
|
||||
Below are the implementations to use with Sun's JVM.
|
||||
<system-property javax.xml.xpath.XPathFactory=
|
||||
"com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl"/>
|
||||
<system-property javax.xml.parsers.DocumentBuilderFactory=
|
||||
"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
|
||||
<system-property javax.xml.parsers.SAXParserFactory=
|
||||
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"/>
|
||||
-->
|
||||
|
||||
<!-- People who want to hardcode their "Solr Home" directly into the
|
||||
WAR File can set the JNDI property here...
|
||||
-->
|
||||
<!--
|
||||
<env-entry>
|
||||
<env-entry-name>solr/home</env-entry-name>
|
||||
<env-entry-value>/put/your/solr/home/here</env-entry-value>
|
||||
<env-entry-type>java.lang.String</env-entry-type>
|
||||
</env-entry>
|
||||
-->
|
||||
|
||||
<!-- Any path (name) registered in solrconfig.xml will be sent to that filter -->
|
||||
<filter>
|
||||
<filter-name>SolrRequestFilter</filter-name>
|
||||
<filter-class>org.apache.solr.servlet.SolrDispatchFilter</filter-class>
|
||||
<!-- If you are wiring Solr into a larger web application which controls
|
||||
the web context root, you will probably want to mount Solr under
|
||||
a path prefix (app.war with /app/solr mounted into it, for example).
|
||||
You will need to put this prefix in front of the SolrDispatchFilter
|
||||
url-pattern mapping too (/solr/*), and also on any paths for
|
||||
legacy Solr servlet mappings you may be using.
|
||||
For the admin JSP's to work properly in a path-prefixed configuration,
|
||||
the admin folder containing the JSPs needs to be under the app context root
|
||||
named to match the path-prefix. For example:
|
||||
|
||||
.war
|
||||
xxx
|
||||
admin
|
||||
stats.jsp
|
||||
-->
|
||||
<!--
|
||||
<init-param>
|
||||
<param-name>path-prefix</param-name>
|
||||
<param-value>/xxx</param-value>
|
||||
</init-param>
|
||||
-->
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<!--
|
||||
NOTE: When using multicore, /admin JSP URLs with a core specified
|
||||
such as /solr/coreName/admin/stats.jsp get forwarded by a
|
||||
RequestDispatcher to /solr/admin/stats.jsp with the specified core
|
||||
put into request scope keyed as "org.apache.solr.SolrCore".
|
||||
|
||||
It is unnecessary, and potentially problematic, to have the SolrDispatchFilter
|
||||
configured to also filter on forwards. Do not configure
|
||||
this dispatcher as <dispatcher>FORWARD</dispatcher>.
|
||||
-->
|
||||
<filter-name>SolrRequestFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<!-- Otherwise it will continue to the old servlets -->
|
||||
|
||||
<servlet>
|
||||
<servlet-name>SolrServer</servlet-name>
|
||||
<display-name>Solr</display-name>
|
||||
<description>Solr Server</description>
|
||||
<servlet-class>org.apache.solr.servlet.SolrServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>SolrUpdate</servlet-name>
|
||||
<display-name>SolrUpdate</display-name>
|
||||
<description>Solr Update Handler</description>
|
||||
<servlet-class>org.apache.solr.servlet.SolrUpdateServlet</servlet-class>
|
||||
<load-on-startup>2</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>Logging</servlet-name>
|
||||
<servlet-class>org.apache.solr.servlet.LogLevelSelection</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<!-- @Deprecated -->
|
||||
<servlet>
|
||||
<servlet-name>ping</servlet-name>
|
||||
<jsp-file>/admin/ping.jsp</jsp-file>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>SolrServer</servlet-name>
|
||||
<url-pattern>/select/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>SolrUpdate</servlet-name>
|
||||
<url-pattern>/update/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>Logging</servlet-name>
|
||||
<url-pattern>/admin/logging</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- @Deprecated -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>ping</servlet-name>
|
||||
<url-pattern>/admin/ping</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<!-- @Deprecated -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>Logging</servlet-name>
|
||||
<url-pattern>/admin/logging.jsp</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<mime-mapping>
|
||||
<extension>.xsl</extension>
|
||||
<!-- per http://www.w3.org/TR/2006/PR-xslt20-20061121/ -->
|
||||
<mime-type>application/xslt+xml</mime-type>
|
||||
</mime-mapping>
|
||||
|
||||
</web-app>
|
12
webapp/src/main/webapp/WEB-INF/weblogic.xml
Executable file
12
webapp/src/main/webapp/WEB-INF/weblogic.xml
Executable file
@@ -0,0 +1,12 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<weblogic-web-app
|
||||
xmlns="http://www.bea.com/ns/weblogic/90"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
|
||||
|
||||
<container-descriptor>
|
||||
<filter-dispatched-requests-enabled>false</filter-dispatched-requests-enabled>
|
||||
</container-descriptor>
|
||||
|
||||
</weblogic-web-app>
|
||||
|
118
webapp/src/main/webapp/admin/_info.jsp
Normal file
118
webapp/src/main/webapp/admin/_info.jsp
Normal file
@@ -0,0 +1,118 @@
|
||||
<%--
|
||||
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.
|
||||
--%>
|
||||
<%@ page import="org.apache.solr.core.SolrConfig,
|
||||
org.apache.solr.core.SolrCore,
|
||||
org.apache.solr.schema.IndexSchema,
|
||||
java.io.File"%>
|
||||
<%@ page import="java.net.InetAddress"%>
|
||||
<%@ page import="java.io.StringWriter"%>
|
||||
<%@ page import="org.apache.solr.core.Config"%>
|
||||
<%@ page import="org.apache.solr.common.util.XML"%>
|
||||
<%@ page import="org.apache.solr.common.SolrException"%>
|
||||
<%@ page import="org.apache.lucene.LucenePackage"%>
|
||||
<%@ page import="java.net.UnknownHostException" %>
|
||||
|
||||
<%!
|
||||
// only try to figure out the hostname once in a static block so
|
||||
// we don't have a potentially slow DNS lookup on every admin request
|
||||
static InetAddress addr = null;
|
||||
static String hostname = "unknown";
|
||||
static {
|
||||
try {
|
||||
addr = InetAddress.getLocalHost();
|
||||
hostname = addr.getCanonicalHostName();
|
||||
} catch (UnknownHostException e) {
|
||||
//default to unknown
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<%
|
||||
//
|
||||
SolrCore core = (SolrCore) request.getAttribute("org.apache.solr.SolrCore");
|
||||
if (core == null) {
|
||||
response.sendError( 404, "missing core name in path" );
|
||||
return;
|
||||
}
|
||||
|
||||
SolrConfig solrConfig = core.getSolrConfig();
|
||||
int port = request.getServerPort();
|
||||
IndexSchema schema = core.getSchema();
|
||||
|
||||
// enabled/disabled is purely from the point of a load-balancer
|
||||
// and has no effect on local server function. If there is no healthcheck
|
||||
// configured, don't put any status on the admin pages.
|
||||
String enabledStatus = null;
|
||||
String enabledFile = solrConfig.get("admin/healthcheck/text()",null);
|
||||
boolean isEnabled = false;
|
||||
if (enabledFile!=null) {
|
||||
isEnabled = new File(enabledFile).exists();
|
||||
}
|
||||
|
||||
String collectionName = schema!=null ? schema.getName():"unknown";
|
||||
|
||||
String defaultSearch = "";
|
||||
{
|
||||
StringWriter tmp = new StringWriter();
|
||||
XML.escapeCharData
|
||||
(solrConfig.get("admin/defaultQuery/text()", ""), tmp);
|
||||
defaultSearch = tmp.toString();
|
||||
}
|
||||
|
||||
String solrImplVersion = "";
|
||||
String solrSpecVersion = "";
|
||||
String luceneImplVersion = "";
|
||||
String luceneSpecVersion = "";
|
||||
|
||||
{
|
||||
Package p;
|
||||
StringWriter tmp;
|
||||
|
||||
p = SolrCore.class.getPackage();
|
||||
|
||||
tmp = new StringWriter();
|
||||
solrImplVersion = p.getImplementationVersion();
|
||||
if (null != solrImplVersion) {
|
||||
XML.escapeCharData(solrImplVersion, tmp);
|
||||
solrImplVersion = tmp.toString();
|
||||
}
|
||||
tmp = new StringWriter();
|
||||
solrSpecVersion = p.getSpecificationVersion() ;
|
||||
if (null != solrSpecVersion) {
|
||||
XML.escapeCharData(solrSpecVersion, tmp);
|
||||
solrSpecVersion = tmp.toString();
|
||||
}
|
||||
|
||||
p = LucenePackage.class.getPackage();
|
||||
|
||||
tmp = new StringWriter();
|
||||
luceneImplVersion = p.getImplementationVersion();
|
||||
if (null != luceneImplVersion) {
|
||||
XML.escapeCharData(luceneImplVersion, tmp);
|
||||
luceneImplVersion = tmp.toString();
|
||||
}
|
||||
tmp = new StringWriter();
|
||||
luceneSpecVersion = p.getSpecificationVersion() ;
|
||||
if (null != luceneSpecVersion) {
|
||||
XML.escapeCharData(luceneSpecVersion, tmp);
|
||||
luceneSpecVersion = tmp.toString();
|
||||
}
|
||||
}
|
||||
|
||||
String cwd=System.getProperty("user.dir");
|
||||
String solrHome= solrConfig.getInstanceDir();
|
||||
%>
|
94
webapp/src/main/webapp/admin/action.jsp
Normal file
94
webapp/src/main/webapp/admin/action.jsp
Normal file
@@ -0,0 +1,94 @@
|
||||
<%@ page contentType="text/html; charset=utf-8" pageEncoding="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.
|
||||
--%>
|
||||
<%@ page import="org.apache.solr.common.util.XML"%>
|
||||
<%@ page import="org.apache.solr.core.SolrCore,
|
||||
org.apache.solr.schema.IndexSchema,
|
||||
java.io.File,
|
||||
java.net.InetAddress,
|
||||
java.net.UnknownHostException"%>
|
||||
<%@ page import="java.util.Date"%>
|
||||
<%@include file="header.jsp" %>
|
||||
<%
|
||||
|
||||
String action = request.getParameter("action");
|
||||
String enableActionStatus = "";
|
||||
boolean isValid = false;
|
||||
|
||||
if (action != null) {
|
||||
// Validate fname
|
||||
if ("Enable".compareTo(action) == 0) isValid = true;
|
||||
if ("Disable".compareTo(action) == 0) isValid = true;
|
||||
}
|
||||
if (isValid) {
|
||||
if ("Enable".compareTo(action) == 0) {
|
||||
try {
|
||||
File enableFile = new File(enabledFile);
|
||||
if (enableFile.createNewFile()) {
|
||||
enableActionStatus += "Enable Succeeded (enable file ";
|
||||
enableActionStatus += enabledFile;
|
||||
enableActionStatus += " created)";
|
||||
} else {
|
||||
enableActionStatus += "Already Enabled";
|
||||
}
|
||||
} catch(Exception e) {
|
||||
enableActionStatus += "Enable Failed: " + e.toString();
|
||||
}
|
||||
}
|
||||
if ("Disable".compareTo(action) == 0) {
|
||||
try {
|
||||
File enableFile = new File(enabledFile);
|
||||
if (enableFile.delete()) {
|
||||
enableActionStatus = "Disable Succeeded (enable file ";
|
||||
enableActionStatus += enabledFile;
|
||||
enableActionStatus += " removed)";
|
||||
} else {
|
||||
enableActionStatus = "Already Disabled";
|
||||
}
|
||||
} catch(Exception e) {
|
||||
enableActionStatus += "Disable Failed: " + e.toString();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
enableActionStatus = "Illegal Action";
|
||||
}
|
||||
// :TODO: might want to rework this so any logging change happens *after*
|
||||
SolrCore.log.info(enableActionStatus);
|
||||
%>
|
||||
<br clear="all">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<H3>Action:</H3>
|
||||
</td>
|
||||
<td>
|
||||
<% XML.escapeCharData(action, out); %><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<H4>Result:</H4>
|
||||
</td>
|
||||
<td>
|
||||
<% XML.escapeCharData(enableActionStatus, out); %><br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br><br>
|
||||
<a href=".">Return to Admin Page</a>
|
||||
</body>
|
||||
</html>
|
498
webapp/src/main/webapp/admin/analysis.jsp
Normal file
498
webapp/src/main/webapp/admin/analysis.jsp
Normal file
@@ -0,0 +1,498 @@
|
||||
<%@ page contentType="text/html; charset=utf-8" pageEncoding="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.
|
||||
--%>
|
||||
<%@ page import="org.apache.lucene.analysis.Analyzer,
|
||||
org.apache.lucene.analysis.Token,
|
||||
org.apache.lucene.analysis.TokenStream,
|
||||
org.apache.lucene.index.Payload,
|
||||
org.apache.lucene.analysis.CharReader,
|
||||
org.apache.lucene.analysis.CharStream,
|
||||
org.apache.solr.analysis.CharFilterFactory,
|
||||
org.apache.solr.analysis.TokenFilterFactory,
|
||||
org.apache.solr.analysis.TokenizerChain,
|
||||
org.apache.solr.analysis.TokenizerFactory,
|
||||
org.apache.solr.schema.FieldType,
|
||||
org.apache.solr.schema.SchemaField,
|
||||
org.apache.solr.common.util.XML,
|
||||
javax.servlet.jsp.JspWriter,java.io.IOException
|
||||
"%>
|
||||
<%@ page import="java.io.Reader"%>
|
||||
<%@ page import="java.io.StringReader"%>
|
||||
<%@ page import="java.util.*"%>
|
||||
<%@ page import="java.math.BigInteger" %>
|
||||
|
||||
<%-- $Id: analysis.jsp 824045 2009-10-11 10:04:01Z koji $ --%>
|
||||
<%-- $Source: /cvs/main/searching/org.apache.solrolarServer/resources/admin/analysis.jsp,v $ --%>
|
||||
<%-- $Name: $ --%>
|
||||
|
||||
<%@include file="header.jsp" %>
|
||||
|
||||
<%
|
||||
// is name a field name or a type name?
|
||||
String nt = request.getParameter("nt");
|
||||
if (nt==null || nt.length()==0) nt="name"; // assume field name
|
||||
nt = nt.toLowerCase().trim();
|
||||
String name = request.getParameter("name");
|
||||
if (name==null || name.length()==0) name="";
|
||||
String val = request.getParameter("val");
|
||||
if (val==null || val.length()==0) val="";
|
||||
String qval = request.getParameter("qval");
|
||||
if (qval==null || qval.length()==0) qval="";
|
||||
String verboseS = request.getParameter("verbose");
|
||||
boolean verbose = verboseS!=null && verboseS.equalsIgnoreCase("on");
|
||||
String qverboseS = request.getParameter("qverbose");
|
||||
boolean qverbose = qverboseS!=null && qverboseS.equalsIgnoreCase("on");
|
||||
String highlightS = request.getParameter("highlight");
|
||||
boolean highlight = highlightS!=null && highlightS.equalsIgnoreCase("on");
|
||||
%>
|
||||
|
||||
<br clear="all">
|
||||
|
||||
<h2>Field Analysis</h2>
|
||||
|
||||
<form method="POST" action="analysis.jsp" accept-charset="UTF-8">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Field
|
||||
<select name="nt">
|
||||
<option <%= nt.equals("name") ? "selected=\"selected\"" : "" %> >name</option>
|
||||
<option <%= nt.equals("type") ? "selected=\"selected\"" : "" %>>type</option>
|
||||
</select></strong>
|
||||
</td>
|
||||
<td>
|
||||
<input class="std" name="name" type="text" value="<% XML.escapeCharData(name, out); %>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Field value (Index)</strong>
|
||||
<br/>
|
||||
verbose output
|
||||
<input name="verbose" type="checkbox"
|
||||
<%= verbose ? "checked=\"true\"" : "" %> >
|
||||
<br/>
|
||||
highlight matches
|
||||
<input name="highlight" type="checkbox"
|
||||
<%= highlight ? "checked=\"true\"" : "" %> >
|
||||
</td>
|
||||
<td>
|
||||
<textarea class="std" rows="8" cols="70" name="val"><% XML.escapeCharData(val,out); %></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Field value (Query)</strong>
|
||||
<br/>
|
||||
verbose output
|
||||
<input name="qverbose" type="checkbox"
|
||||
<%= qverbose ? "checked=\"true\"" : "" %> >
|
||||
</td>
|
||||
<td>
|
||||
<textarea class="std" rows="1" cols="70" name="qval"><% XML.escapeCharData(qval,out); %></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<input class="stdbutton" type="submit" value="analyze">
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
|
||||
<%
|
||||
SchemaField field=null;
|
||||
|
||||
if (name!="") {
|
||||
if (nt.equals("name")) {
|
||||
try {
|
||||
field = schema.getField(name);
|
||||
} catch (Exception e) {
|
||||
out.print("<strong>Unknown Field: ");
|
||||
XML.escapeCharData(name, out);
|
||||
out.println("</strong>");
|
||||
}
|
||||
} else {
|
||||
FieldType t = schema.getFieldTypes().get(name);
|
||||
if (null == t) {
|
||||
out.print("<strong>Unknown Field Type: ");
|
||||
XML.escapeCharData(name, out);
|
||||
out.println("</strong>");
|
||||
} else {
|
||||
field = new SchemaField("fakefieldoftype:"+name, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (field!=null) {
|
||||
HashSet<Tok> matches = null;
|
||||
if (qval!="" && highlight) {
|
||||
Reader reader = new StringReader(qval);
|
||||
Analyzer analyzer = field.getType().getQueryAnalyzer();
|
||||
TokenStream tstream = analyzer.reusableTokenStream(field.getName(),reader);
|
||||
tstream.reset();
|
||||
List<Token> tokens = getTokens(tstream);
|
||||
matches = new HashSet<Tok>();
|
||||
for (Token t : tokens) { matches.add( new Tok(t,0)); }
|
||||
}
|
||||
|
||||
if (val!="") {
|
||||
out.println("<h3>Index Analyzer</h3>");
|
||||
doAnalyzer(out, field, val, false, verbose,matches);
|
||||
}
|
||||
if (qval!="") {
|
||||
out.println("<h3>Query Analyzer</h3>");
|
||||
doAnalyzer(out, field, qval, true, qverbose,null);
|
||||
}
|
||||
}
|
||||
|
||||
%>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
<%!
|
||||
private static void doAnalyzer(JspWriter out, SchemaField field, String val, boolean queryAnalyser, boolean verbose, Set<Tok> match) throws Exception {
|
||||
|
||||
FieldType ft = field.getType();
|
||||
Analyzer analyzer = queryAnalyser ?
|
||||
ft.getQueryAnalyzer() : ft.getAnalyzer();
|
||||
if (analyzer instanceof TokenizerChain) {
|
||||
TokenizerChain tchain = (TokenizerChain)analyzer;
|
||||
CharFilterFactory[] cfiltfacs = tchain.getCharFilterFactories();
|
||||
TokenizerFactory tfac = tchain.getTokenizerFactory();
|
||||
TokenFilterFactory[] filtfacs = tchain.getTokenFilterFactories();
|
||||
|
||||
if( cfiltfacs != null ){
|
||||
String source = val;
|
||||
for(CharFilterFactory cfiltfac : cfiltfacs ){
|
||||
CharStream reader = CharReader.get(new StringReader(source));
|
||||
reader = cfiltfac.create(reader);
|
||||
if(verbose){
|
||||
writeHeader(out, cfiltfac.getClass(), cfiltfac.getArgs());
|
||||
source = writeCharStream(out, reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TokenStream tstream = tfac.create(tchain.charStream(new StringReader(val)));
|
||||
List<Token> tokens = getTokens(tstream);
|
||||
if (verbose) {
|
||||
writeHeader(out, tfac.getClass(), tfac.getArgs());
|
||||
}
|
||||
|
||||
writeTokens(out, tokens, ft, verbose, match);
|
||||
|
||||
for (TokenFilterFactory filtfac : filtfacs) {
|
||||
if (verbose) {
|
||||
writeHeader(out, filtfac.getClass(), filtfac.getArgs());
|
||||
}
|
||||
|
||||
final Iterator<Token> iter = tokens.iterator();
|
||||
tstream = filtfac.create( new TokenStream() {
|
||||
public Token next() throws IOException {
|
||||
return iter.hasNext() ? iter.next() : null;
|
||||
}
|
||||
}
|
||||
);
|
||||
tokens = getTokens(tstream);
|
||||
|
||||
writeTokens(out, tokens, ft, verbose, match);
|
||||
}
|
||||
|
||||
} else {
|
||||
TokenStream tstream = analyzer.reusableTokenStream(field.getName(),new StringReader(val));
|
||||
tstream.reset();
|
||||
List<Token> tokens = getTokens(tstream);
|
||||
if (verbose) {
|
||||
writeHeader(out, analyzer.getClass(), new HashMap<String,String>());
|
||||
}
|
||||
writeTokens(out, tokens, ft, verbose, match);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static List<Token> getTokens(TokenStream tstream) throws IOException {
|
||||
List<Token> tokens = new ArrayList<Token>();
|
||||
while (true) {
|
||||
Token t = tstream.next();
|
||||
if (t==null) break;
|
||||
tokens.add(t);
|
||||
}
|
||||
return tokens;
|
||||
}
|
||||
|
||||
|
||||
private static class Tok {
|
||||
Token token;
|
||||
int pos;
|
||||
Tok(Token token, int pos) {
|
||||
this.token=token;
|
||||
this.pos=pos;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return ((Tok)o).token.termText().equals(token.termText());
|
||||
}
|
||||
public int hashCode() {
|
||||
return token.termText().hashCode();
|
||||
}
|
||||
public String toString() {
|
||||
return token.termText();
|
||||
}
|
||||
}
|
||||
|
||||
private static interface ToStr {
|
||||
public String toStr(Object o);
|
||||
}
|
||||
|
||||
private static void printRow(JspWriter out, String header, List[] arrLst, ToStr converter, boolean multival, boolean verbose, Set<Tok> match) throws IOException {
|
||||
// find the maximum number of terms for any position
|
||||
int maxSz=1;
|
||||
if (multival) {
|
||||
for (List lst : arrLst) {
|
||||
maxSz = Math.max(lst.size(), maxSz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int idx=0; idx<maxSz; idx++) {
|
||||
out.println("<tr>");
|
||||
if (idx==0 && verbose) {
|
||||
if (header != null) {
|
||||
out.print("<th NOWRAP rowspan=\""+maxSz+"\">");
|
||||
XML.escapeCharData(header,out);
|
||||
out.println("</th>");
|
||||
}
|
||||
}
|
||||
|
||||
for (int posIndex=0; posIndex<arrLst.length; posIndex++) {
|
||||
List<Tok> lst = arrLst[posIndex];
|
||||
if (lst.size() <= idx) continue;
|
||||
if (match!=null && match.contains(lst.get(idx))) {
|
||||
out.print("<td class=\"highlight\"");
|
||||
} else {
|
||||
out.print("<td class=\"debugdata\"");
|
||||
}
|
||||
|
||||
// if the last value in the column, use up
|
||||
// the rest of the space via rowspan.
|
||||
if (lst.size() == idx+1 && lst.size() < maxSz) {
|
||||
out.print("rowspan=\""+(maxSz-lst.size()+1)+'"');
|
||||
}
|
||||
|
||||
out.print('>');
|
||||
|
||||
XML.escapeCharData(converter.toStr(lst.get(idx)), out);
|
||||
out.print("</td>");
|
||||
}
|
||||
|
||||
out.println("</tr>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static String isPayloadString( Payload p ) {
|
||||
String sp = new String( p.getData() );
|
||||
for( int i=0; i < sp.length(); i++ ) {
|
||||
if( !Character.isDefined( sp.charAt(i) ) || Character.isISOControl( sp.charAt(i) ) )
|
||||
return "";
|
||||
}
|
||||
return "(" + sp + ")";
|
||||
}
|
||||
|
||||
static void writeHeader(JspWriter out, Class clazz, Map<String,String> args) throws IOException {
|
||||
out.print("<h4>");
|
||||
out.print(clazz.getName());
|
||||
XML.escapeCharData(" "+args,out);
|
||||
out.println("</h4>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// readable, raw, pos, type, start/end
|
||||
static void writeTokens(JspWriter out, List<Token> tokens, final FieldType ft, boolean verbose, Set<Tok> match) throws IOException {
|
||||
|
||||
// Use a map to tell what tokens are in what positions
|
||||
// because some tokenizers/filters may do funky stuff with
|
||||
// very large increments, or negative increments.
|
||||
HashMap<Integer,List<Tok>> map = new HashMap<Integer,List<Tok>>();
|
||||
boolean needRaw=false;
|
||||
int pos=0;
|
||||
for (Token t : tokens) {
|
||||
if (!t.termText().equals(ft.indexedToReadable(t.termText()))) {
|
||||
needRaw=true;
|
||||
}
|
||||
|
||||
pos += t.getPositionIncrement();
|
||||
List lst = map.get(pos);
|
||||
if (lst==null) {
|
||||
lst = new ArrayList(1);
|
||||
map.put(pos,lst);
|
||||
}
|
||||
Tok tok = new Tok(t,pos);
|
||||
lst.add(tok);
|
||||
}
|
||||
|
||||
List<Tok>[] arr = (List<Tok>[])map.values().toArray(new ArrayList[map.size()]);
|
||||
|
||||
/* Jetty 6.1.3 miscompiles this generics version...
|
||||
Arrays.sort(arr, new Comparator<List<Tok>>() {
|
||||
public int compare(List<Tok> toks, List<Tok> toks1) {
|
||||
return toks.get(0).pos - toks1.get(0).pos;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Arrays.sort(arr, new Comparator() {
|
||||
public int compare(Object toks, Object toks1) {
|
||||
return ((List<Tok>)toks).get(0).pos - ((List<Tok>)toks1).get(0).pos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
);
|
||||
|
||||
out.println("<table width=\"auto\" class=\"analysis\" border=\"1\">");
|
||||
|
||||
if (verbose) {
|
||||
printRow(out,"term position", arr, new ToStr() {
|
||||
public String toStr(Object o) {
|
||||
return Integer.toString(((Tok)o).pos);
|
||||
}
|
||||
}
|
||||
,false
|
||||
,verbose
|
||||
,null);
|
||||
}
|
||||
|
||||
|
||||
printRow(out,"term text", arr, new ToStr() {
|
||||
public String toStr(Object o) {
|
||||
return ft.indexedToReadable( ((Tok)o).token.termText() );
|
||||
}
|
||||
}
|
||||
,true
|
||||
,verbose
|
||||
,match
|
||||
);
|
||||
|
||||
if (needRaw) {
|
||||
printRow(out,"raw text", arr, new ToStr() {
|
||||
public String toStr(Object o) {
|
||||
// page is UTF-8, so anything goes.
|
||||
return ((Tok)o).token.termText();
|
||||
}
|
||||
}
|
||||
,true
|
||||
,verbose
|
||||
,match
|
||||
);
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
printRow(out,"term type", arr, new ToStr() {
|
||||
public String toStr(Object o) {
|
||||
String tt = ((Tok)o).token.type();
|
||||
if (tt == null) {
|
||||
return "null";
|
||||
} else {
|
||||
return tt;
|
||||
}
|
||||
}
|
||||
}
|
||||
,true
|
||||
,verbose,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
printRow(out,"source start,end", arr, new ToStr() {
|
||||
public String toStr(Object o) {
|
||||
Token t = ((Tok)o).token;
|
||||
return Integer.toString(t.startOffset()) + ',' + t.endOffset() ;
|
||||
}
|
||||
}
|
||||
,true
|
||||
,verbose
|
||||
,null
|
||||
);
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
printRow(out,"payload", arr, new ToStr() {
|
||||
public String toStr(Object o) {
|
||||
Token t = ((Tok)o).token;
|
||||
Payload p = t.getPayload();
|
||||
if( null != p ) {
|
||||
BigInteger bi = new BigInteger( p.getData() );
|
||||
String ret = bi.toString( 16 );
|
||||
if (ret.length() % 2 != 0) {
|
||||
// Pad with 0
|
||||
ret = "0"+ret;
|
||||
}
|
||||
ret += isPayloadString( p );
|
||||
return ret;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
,true
|
||||
,verbose
|
||||
,null
|
||||
);
|
||||
}
|
||||
|
||||
out.println("</table>");
|
||||
}
|
||||
|
||||
static String writeCharStream(JspWriter out, CharStream input) throws IOException {
|
||||
out.println("<table width=\"auto\" class=\"analysis\" border=\"1\">");
|
||||
out.println("<tr>");
|
||||
|
||||
out.print("<th NOWRAP>");
|
||||
XML.escapeCharData("text",out);
|
||||
out.println("</th>");
|
||||
|
||||
final int BUFFER_SIZE = 1024;
|
||||
char[] buf = new char[BUFFER_SIZE];
|
||||
int len = 0;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
do {
|
||||
len = input.read( buf, 0, BUFFER_SIZE );
|
||||
if( len > 0 )
|
||||
sb.append(buf, 0, len);
|
||||
} while( len == BUFFER_SIZE );
|
||||
out.print("<td class=\"debugdata\">");
|
||||
XML.escapeCharData(sb.toString(),out);
|
||||
out.println("</td>");
|
||||
|
||||
out.println("</tr>");
|
||||
out.println("</table>");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
%>
|
179
webapp/src/main/webapp/admin/analysis.xsl
Normal file
179
webapp/src/main/webapp/admin/analysis.xsl
Normal file
@@ -0,0 +1,179 @@
|
||||
<?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"
|
||||
encoding="utf-8"
|
||||
media-type="text/html; charset=UTF-8"
|
||||
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="78" width="142" src="solr_small.png" alt="SOLR"/>
|
||||
</a>
|
||||
<h1>Solr Admin (<xsl:value-of select="solr/meta/collection" />)</h1>
|
||||
<div style="margin-top: 1em;">
|
||||
<h2>Field Analysis</h2>
|
||||
<xsl:apply-templates/>
|
||||
<a href=".">Return to Admin Page</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:include href="meta.xsl"/>
|
||||
|
||||
<xsl:template match="solr/analysis/form">
|
||||
<form method="POST" action="analysis.jsp">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Field name</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input class="std" name="name" type="text" value="{field}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Field value (Index)</strong>
|
||||
<br/>
|
||||
verbose output <input name="verbose" type="checkbox" checked="true"/>
|
||||
<br/>
|
||||
highlight matches <input name="highlight" type="checkbox" checked="true"/>
|
||||
</td>
|
||||
<td>
|
||||
<textarea class="std" rows="8" cols="70" name="val"><xsl:value-of select="fieldIndexValue" /></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Field value (Query)</strong>
|
||||
<br/>
|
||||
verbose output <input name="qverbose" type="checkbox" checked="true"/>
|
||||
</td>
|
||||
<td>
|
||||
<textarea class="std" rows="1" cols="70" name="qval"><xsl:value-of select="fieldQueryValue" /></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<input class="stdbutton" type="submit" value="analyze"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/analysis/results/indexAnalyzer">
|
||||
<h4>Index Analyzer</h4>
|
||||
<xsl:for-each select="factory">
|
||||
<h5 style="margin-left: 1em;"><xsl:apply-templates select="@class"/></h5>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/analysis/results/indexAnalyzer/factory/args">
|
||||
<div style="margin-left: 2em; font-weight: bold;">{
|
||||
<xsl:for-each select="arg">
|
||||
<xsl:apply-templates select="@name"/>=<xsl:value-of select="."/>,
|
||||
</xsl:for-each>
|
||||
}</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/analysis/results/indexAnalyzer/factory/tokens">
|
||||
<div style="margin-left: 2em;">
|
||||
<table width="auto" class="analysis" border="1">
|
||||
<tr>
|
||||
<th>text</th>
|
||||
<th>type</th>
|
||||
<th>position</th>
|
||||
<th>start</th>
|
||||
<th>end</th>
|
||||
</tr>
|
||||
<xsl:for-each select="token">
|
||||
<tr>
|
||||
<td><xsl:value-of select="."/></td>
|
||||
<td><xsl:apply-templates select="@type"/></td>
|
||||
<td><xsl:apply-templates select="@pos"/></td>
|
||||
<td><xsl:apply-templates select="@start"/></td>
|
||||
<td><xsl:apply-templates select="@end"/></td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/analysis/results/queryAnalyzer">
|
||||
<h4>Query Analyzer</h4>
|
||||
<xsl:for-each select="factory">
|
||||
<h5 style="margin-left: 1em;"><xsl:apply-templates select="@class"/></h5>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/analysis/results/queryAnalyzer/factory/args">
|
||||
<div style="margin-left: 2em; font-weight: bold;">{
|
||||
<xsl:for-each select="arg">
|
||||
<xsl:apply-templates select="@name"/>=<xsl:value-of select="."/>,
|
||||
</xsl:for-each>
|
||||
}</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/analysis/results/queryAnalyzer/factory/tokens">
|
||||
<div style="margin-left: 2em;">
|
||||
<table width="auto" class="analysis" border="1">
|
||||
<tr>
|
||||
<th>text</th>
|
||||
<th>type</th>
|
||||
<th>position</th>
|
||||
<th>start</th>
|
||||
<th>end</th>
|
||||
</tr>
|
||||
<xsl:for-each select="token">
|
||||
<tr>
|
||||
<td><xsl:value-of select="."/></td>
|
||||
<td><xsl:apply-templates select="@type"/></td>
|
||||
<td><xsl:apply-templates select="@pos"/></td>
|
||||
<td><xsl:apply-templates select="@start"/></td>
|
||||
<td><xsl:apply-templates select="@end"/></td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
160
webapp/src/main/webapp/admin/distributiondump.jsp
Normal file
160
webapp/src/main/webapp/admin/distributiondump.jsp
Normal file
@@ -0,0 +1,160 @@
|
||||
<%@ page contentType="text/html; charset=utf-8" pageEncoding="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.
|
||||
--%>
|
||||
|
||||
<%@ page import="org.apache.solr.core.SolrCore,
|
||||
org.apache.solr.schema.IndexSchema,
|
||||
java.io.BufferedReader,
|
||||
java.io.File,
|
||||
java.io.FilenameFilter,
|
||||
java.io.FileReader,
|
||||
java.net.InetAddress,
|
||||
java.net.UnknownHostException,
|
||||
java.util.Date"%>
|
||||
|
||||
<%@include file="header.jsp" %>
|
||||
|
||||
<%
|
||||
File slaveinfo = new File(solrHome + "logs/snappuller.status");
|
||||
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuffer buffer2 = new StringBuffer();
|
||||
String mode = "";
|
||||
|
||||
if (slaveinfo.canRead()) {
|
||||
// Slave instance
|
||||
mode = "Slave";
|
||||
File slavevers = new File(solrHome + "logs/snapshot.current");
|
||||
BufferedReader inforeader = new BufferedReader(new FileReader(slaveinfo));
|
||||
BufferedReader versreader = new BufferedReader(new FileReader(slavevers));
|
||||
buffer.append("<tr>\n" +
|
||||
"<td>\n" +
|
||||
"Version:" +
|
||||
"</td>\n" +
|
||||
"<td>\n")
|
||||
.append( versreader.readLine())
|
||||
.append( "<td>\n" +
|
||||
"</td>\n" +
|
||||
"</tr>\n" +
|
||||
"<tr>\n" +
|
||||
"<td>\n" +
|
||||
"Status:" +
|
||||
"</td>\n" +
|
||||
"<td>\n")
|
||||
.append( inforeader.readLine())
|
||||
.append( "</td>\n" +
|
||||
"</tr>\n");
|
||||
} else {
|
||||
// Master instance
|
||||
mode = "Master";
|
||||
File masterdir = new File(solrHome + "logs/clients");
|
||||
FilenameFilter sfilter = new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.startsWith("snapshot.status");
|
||||
}
|
||||
};
|
||||
FilenameFilter cfilter = new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.startsWith("snapshot.current");
|
||||
}
|
||||
};
|
||||
File[] clients = masterdir.listFiles(cfilter);
|
||||
if (clients == null) {
|
||||
buffer.append("<tr>\n" +
|
||||
"<td>\n" +
|
||||
"</td>\n" +
|
||||
"<td>\n" +
|
||||
"No distribution info present" +
|
||||
"</td>\n" +
|
||||
"</tr>\n");
|
||||
} else {
|
||||
buffer.append("<h4>Client Snapshot In Use:</h4>\n" +
|
||||
"<tr>\n" +
|
||||
"<th>\n" +
|
||||
"Client" +
|
||||
"</th>\n" +
|
||||
"<th>\n" +
|
||||
"Version" +
|
||||
"</th>\n" +
|
||||
"</tr>\n");
|
||||
int i = 0;
|
||||
while (i < clients.length) {
|
||||
String fileName=clients[i].toString();
|
||||
int p=fileName.indexOf("snapshot.current");
|
||||
String clientName=fileName.substring(p+17);
|
||||
BufferedReader reader = new BufferedReader(new FileReader(clients[i]));
|
||||
buffer.append("<tr>\n" +
|
||||
"<td>\n" +
|
||||
clientName +
|
||||
"</td>\n" +
|
||||
"<td>\n")
|
||||
.append( reader.readLine())
|
||||
.append( "</td>\n" +
|
||||
"</tr>\n" +
|
||||
"<tr>\n" +
|
||||
"</tr>\n");
|
||||
i++;
|
||||
}
|
||||
clients = masterdir.listFiles(sfilter);
|
||||
if (clients!=null) {
|
||||
buffer.append("</table>\n" +
|
||||
"<h4>Client Snapshot Distribution Status:</h4>\n" +
|
||||
"<table>\n" +
|
||||
"<tr>\n" +
|
||||
"<th>\n" +
|
||||
"Client" +
|
||||
"</th>\n" +
|
||||
"<th>\n" +
|
||||
"Status" +
|
||||
"</th>\n" +
|
||||
"</tr>\n");
|
||||
i = 0;
|
||||
while (i < clients.length) {
|
||||
String fileName=clients[i].toString();
|
||||
int p=fileName.indexOf("snapshot.status");
|
||||
String clientName=fileName.substring(p+16);
|
||||
BufferedReader reader = new BufferedReader(new FileReader(clients[i]));
|
||||
buffer.append("<tr>\n" +
|
||||
"<td>\n" +
|
||||
clientName +
|
||||
"</td>\n" +
|
||||
"<td>\n")
|
||||
.append( reader.readLine())
|
||||
.append( "</td>\n" +
|
||||
"</tr>\n" +
|
||||
"<tr>\n" +
|
||||
"</tr>\n");
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
|
||||
<br clear="all">
|
||||
<h2>Distribution Info: <%= mode %> Server</h2>
|
||||
<br clear="all" />
|
||||
(<a href="http://wiki.apache.org/solr/CollectionDistribution">What Is This Page?</a>)
|
||||
<br clear="all" />
|
||||
<table>
|
||||
<%= buffer %>
|
||||
</table>
|
||||
<br><br>
|
||||
<a href=".">Return to Admin Page</a>
|
||||
</body>
|
||||
</html>
|
BIN
webapp/src/main/webapp/admin/favicon.ico
Executable file
BIN
webapp/src/main/webapp/admin/favicon.ico
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
137
webapp/src/main/webapp/admin/form.jsp
Normal file
137
webapp/src/main/webapp/admin/form.jsp
Normal file
@@ -0,0 +1,137 @@
|
||||
<%@ page contentType="text/html; charset=utf-8" pageEncoding="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.
|
||||
--%>
|
||||
<%@include file="header.jsp" %>
|
||||
|
||||
<br clear="all">
|
||||
<form name="queryForm" method="GET" action="../select" accept-charset="UTF-8">
|
||||
<!-- 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.
|
||||
-->
|
||||
<input name="indent" type="hidden" value="on">
|
||||
<input name="version" type="hidden" value="2.2">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Solr/Lucene Statement</strong>
|
||||
</td>
|
||||
<td>
|
||||
<textarea rows="5" cols="60" name="q"><%= defaultSearch %></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Filter Query</strong>
|
||||
</td>
|
||||
<td>
|
||||
<textarea rows="2" cols="60" name="fq"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Start Row</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input name="start" type="text" value="0">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Maximum Rows Returned</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input name="rows" type="text" value="10">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Fields to Return</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input name="fl" type="text" value="*,score">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Query Type</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input name="qt" type="text" value="standard">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Output Type</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input name="wt" type="text" value="standard">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Debug: enable</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input name="debugQuery" type="checkbox" >
|
||||
<em><font size="-1"> Note: you may need to "view source" in your browser to see explain() correctly indented.</font></em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Debug: explain others</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input name="explainOther" type="text" >
|
||||
<em><font size="-1"> Apply original query scoring to matches of this query to see how they compare.</font></em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Enable Highlighting</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input name="hl" type="checkbox" >
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Fields to Highlight</strong>
|
||||
</td>
|
||||
<td>
|
||||
<input name="hl.fl" type="text" >
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<input class="stdbutton" type="submit" value="search" onclick="if (queryForm.q.value.length==0) { alert('no empty queries, please'); return false; } else { queryForm.submit(); } ">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<br clear="all">
|
||||
<em>
|
||||
This form demonstrates the most common query options available for the
|
||||
built in Query Types. Please consult the Solr Wiki for additional
|
||||
Query Parameters.
|
||||
</em>
|
||||
|
||||
</body>
|
||||
</html>
|
72
webapp/src/main/webapp/admin/get-file.jsp
Normal file
72
webapp/src/main/webapp/admin/get-file.jsp
Normal file
@@ -0,0 +1,72 @@
|
||||
<%@ page contentType="text/plain; charset=utf-8" pageEncoding="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.
|
||||
--%>
|
||||
<%@ page import="org.apache.solr.core.Config,
|
||||
org.apache.solr.core.SolrCore,
|
||||
org.apache.solr.core.SolrConfig,
|
||||
java.io.InputStream,
|
||||
java.io.InputStreamReader,
|
||||
java.io.Reader,
|
||||
java.util.StringTokenizer,
|
||||
java.util.logging.Logger"%>
|
||||
<%!
|
||||
static Logger log = Logger.getLogger(SolrCore.class.getName());
|
||||
%>
|
||||
<%
|
||||
// NOTE -- this file will be removed in a future release
|
||||
log.warning("Using deprecated JSP: " + request.getRequestURL().append("?").append(request.getQueryString()) + " -- check the ShowFileRequestHandler" );
|
||||
|
||||
Object ocore = request.getAttribute("org.apache.solr.SolrCore");
|
||||
SolrCore core = ocore instanceof SolrCore? (SolrCore) ocore : SolrCore.getSolrCore();
|
||||
String fname = request.getParameter("file");
|
||||
String optional = request.getParameter("optional");
|
||||
String gettableFiles = core.getSolrConfig().get("admin/gettableFiles","");
|
||||
StringTokenizer st = new StringTokenizer(gettableFiles);
|
||||
InputStream is;
|
||||
boolean isValid = false;
|
||||
boolean isOptional = false;
|
||||
if (fname != null) {
|
||||
// Validate fname
|
||||
while(st.hasMoreTokens()) {
|
||||
if (st.nextToken().compareTo(fname) == 0) isValid = true;
|
||||
}
|
||||
}
|
||||
if (optional!=null && optional.equalsIgnoreCase("y")) {
|
||||
isOptional=true;
|
||||
}
|
||||
if (isValid) {
|
||||
try {
|
||||
is= core.getSolrConfig().openResource(fname);
|
||||
Reader input = new InputStreamReader(is);
|
||||
char[] buf = new char[4096];
|
||||
while (true) {
|
||||
int len = input.read(buf);
|
||||
if (len<=0) break;
|
||||
out.write(buf,0,len);
|
||||
}
|
||||
}
|
||||
catch (RuntimeException re) {
|
||||
if (!isOptional) {
|
||||
throw re;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.println("<ERROR>");
|
||||
out.println("Permission denied for file "+ fname);
|
||||
out.println("</ERROR>");
|
||||
}
|
||||
%>
|
24
webapp/src/main/webapp/admin/get-properties.jsp
Normal file
24
webapp/src/main/webapp/admin/get-properties.jsp
Normal file
@@ -0,0 +1,24 @@
|
||||
<%@ page contentType="text/plain;charset=UTF-8" language="java" %>
|
||||
<%--
|
||||
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.
|
||||
--%>
|
||||
<%
|
||||
java.util.Enumeration e = System.getProperties().propertyNames();
|
||||
while(e.hasMoreElements()) {
|
||||
String prop = (String)e.nextElement();
|
||||
out.println(prop + " = " + System.getProperty(prop));
|
||||
}
|
||||
%>
|
41
webapp/src/main/webapp/admin/header.jsp
Normal file
41
webapp/src/main/webapp/admin/header.jsp
Normal file
@@ -0,0 +1,41 @@
|
||||
<%@ page contentType="text/html; charset=utf-8" pageEncoding="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.
|
||||
--%>
|
||||
<html>
|
||||
<head>
|
||||
<%
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
%>
|
||||
<%@include file="_info.jsp" %>
|
||||
<script>
|
||||
var host_name="<%= hostname %>"
|
||||
</script>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="solr-admin.css">
|
||||
<link rel="icon" href="favicon.ico" type="image/ico"></link>
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
|
||||
<title>Solr admin page</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a href="."><img border="0" align="right" height="78" width="142" src="solr_small.png" alt="Solr"></a>
|
||||
<h1>Solr Admin (<%= collectionName %>)
|
||||
<%= enabledStatus==null ? "" : (isEnabled ? " - Enabled" : " - Disabled") %> </h1>
|
||||
|
||||
<%= hostname %>:<%= port %><br/>
|
||||
cwd=<%= cwd %> SolrHome=<%= solrHome %>
|
156
webapp/src/main/webapp/admin/index.jsp
Normal file
156
webapp/src/main/webapp/admin/index.jsp
Normal file
@@ -0,0 +1,156 @@
|
||||
<%@ page contentType="text/html; charset=utf-8" pageEncoding="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: index.jsp 793088 2009-07-10 19:37:30Z hossman $ --%>
|
||||
<%-- $Source: /cvs/main/searching/SolrServer/resources/admin/index.jsp,v $ --%>
|
||||
<%-- $Name: $ --%>
|
||||
|
||||
<%@ page import="java.util.Date" %>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ page import="java.util.Collection" %>
|
||||
<%@ page import="org.apache.solr.request.SolrRequestHandler"%>
|
||||
<%@ page import="org.apache.solr.handler.ReplicationHandler" %>
|
||||
|
||||
<%-- jsp:include page="header.jsp"/ --%>
|
||||
<%-- do a verbatim include so we can use the local vars --%>
|
||||
<%@include file="header.jsp" %>
|
||||
<%boolean replicationhandler = !core.getRequestHandlers(ReplicationHandler.class).isEmpty();%>
|
||||
<br clear="all">
|
||||
<table>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<h3>Solr</h3>
|
||||
</td>
|
||||
<td>
|
||||
<% if (null != core.getSchemaResource()) { %>
|
||||
[<a href="file/?file=<%=core.getSchemaResource()%>">Schema</a>]
|
||||
<% }
|
||||
if (null != core.getConfigResource()) { %>
|
||||
[<a href="file/?file=<%=core.getConfigResource()%>">Config</a>]
|
||||
<% } %>
|
||||
[<a href="analysis.jsp?highlight=on">Analysis</a>]
|
||||
[<a href="schema.jsp">Schema Browser</a>] <%if(replicationhandler){%>[<a href="replication/index.jsp">Replication</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">Logging</a>]
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<%-- List the cores (that arent this one) so we can switch --%>
|
||||
<% org.apache.solr.core.CoreContainer cores = (org.apache.solr.core.CoreContainer)request.getAttribute("org.apache.solr.CoreContainer");
|
||||
if (cores!=null) {
|
||||
Collection<String> names = cores.getCoreNames();
|
||||
if (names.size() > 1) {%><tr><td><strong>Cores:</strong><br></td><td><%
|
||||
for (String name : names) {
|
||||
%>[<a href="../../<%=name%>/admin/"><%=name%></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>]
|
||||
<%
|
||||
if (enabledFile!=null)
|
||||
if (isEnabled) {
|
||||
%>
|
||||
[<a href="action.jsp?action=Disable">Disable</a>]
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
[<a href="action.jsp?action=Enable">Enable</a>]
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<%
|
||||
// a quick hack to get rid of get-file.jsp -- note this still spits out invalid HTML
|
||||
out.write( org.apache.solr.handler.admin.ShowFileRequestHandler.getFileContents( "admin-extra.html" ) );
|
||||
%>
|
||||
|
||||
</table><P>
|
||||
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<h3>Make a Query</h3>
|
||||
</td>
|
||||
<td>
|
||||
[<a href="form.jsp">Full Interface</a>]
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Query String:
|
||||
</td>
|
||||
<td colspan=2>
|
||||
<form name=queryForm method="GET" action="../select/" accept-charset="UTF-8">
|
||||
<textarea class="std" rows="4" cols="40" name="q"><%= defaultSearch %></textarea>
|
||||
<input name="version" type="hidden" value="2.2">
|
||||
<input name="start" type="hidden" value="0">
|
||||
<input name="rows" type="hidden" value="10">
|
||||
<input name="indent" type="hidden" value="on">
|
||||
<br><input class="stdbutton" type="submit" value="search"
|
||||
onclick="if (queryForm.q.value.length==0) { alert('no empty queries, please'); return false; } else { queryForm.submit(); } ">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table><p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<h3>Assistance</h3>
|
||||
</td>
|
||||
<td>
|
||||
[<a href="http://lucene.apache.org/solr/">Documentation</a>]
|
||||
[<a href="http://issues.apache.org/jira/browse/SOLR">Issue Tracker</a>]
|
||||
[<a href="mailto:solr-user@lucene.apache.org">Send Email</a>]
|
||||
<br>
|
||||
[<a href="http://wiki.apache.org/solr/SolrQuerySyntax">Solr Query Syntax</a>]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
Current Time: <%= new Date() %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
Server Start At: <%= new Date(core.getStartTime()) %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
32
webapp/src/main/webapp/admin/jquery-1.2.3.min.js
vendored
Normal file
32
webapp/src/main/webapp/admin/jquery-1.2.3.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
34
webapp/src/main/webapp/admin/meta.xsl
Normal file
34
webapp/src/main/webapp/admin/meta.xsl
Normal file
@@ -0,0 +1,34 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version="1.0">
|
||||
|
||||
<xsl:output
|
||||
method="html"
|
||||
encoding="utf-8"
|
||||
media-type="text/html; charset=UTF-8"
|
||||
indent="yes"
|
||||
doctype-public="-//W3C//DTD HTML 4.01//EN"
|
||||
doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
|
||||
|
||||
<xsl:template match="solr/meta">
|
||||
<xsl:value-of select="host" />:<xsl:value-of select="port" />
|
||||
cwd=<xsl:value-of select="cwd" /> SolrHome=<xsl:value-of select="solrHome" />
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
52
webapp/src/main/webapp/admin/ping.jsp
Normal file
52
webapp/src/main/webapp/admin/ping.jsp
Normal file
@@ -0,0 +1,52 @@
|
||||
<%@ page contentType="text/xml; charset=utf-8" pageEncoding="UTF-8" language="java" %>
|
||||
<%--
|
||||
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.
|
||||
--%>
|
||||
<%@ page import="org.apache.solr.core.SolrConfig,
|
||||
org.apache.solr.core.SolrCore,
|
||||
org.apache.solr.common.SolrException"%>
|
||||
<%@ page import="org.apache.solr.request.LocalSolrQueryRequest"%>
|
||||
<%@ page import="org.apache.solr.request.SolrQueryResponse"%>
|
||||
<%@ page import="org.apache.solr.request.ServletSolrParams"%>
|
||||
<%@ page import="org.apache.solr.request.SolrQueryRequest"%>
|
||||
|
||||
<%@include file="_info.jsp" %>
|
||||
<?xml-stylesheet type="text/xsl" href="ping.xsl"?>
|
||||
|
||||
<solr>
|
||||
<core><%=core.getName()%></core>
|
||||
<ping>
|
||||
<%
|
||||
SolrQueryRequest req = core.getPingQueryRequest();
|
||||
SolrQueryResponse resp = new SolrQueryResponse();
|
||||
try {
|
||||
core.execute(req,resp);
|
||||
if (resp.getException() == null) {
|
||||
// No need for explicit status in the body, when the standard HTTP
|
||||
// response codes already transmit success/failure message
|
||||
out.println("<status>200</status>");
|
||||
}
|
||||
else if (resp.getException() != null) {
|
||||
throw resp.getException();
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
throw t;
|
||||
} finally {
|
||||
req.close();
|
||||
}
|
||||
%>
|
||||
</ping>
|
||||
</solr>
|
71
webapp/src/main/webapp/admin/ping.xsl
Normal file
71
webapp/src/main/webapp/admin/ping.xsl
Normal file
@@ -0,0 +1,71 @@
|
||||
<?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"
|
||||
encoding="utf-8"
|
||||
media-type="text/html; charset=UTF-8"
|
||||
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="78" width="142" src="solr_small.png" 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>
|
38
webapp/src/main/webapp/admin/raw-schema.jsp
Normal file
38
webapp/src/main/webapp/admin/raw-schema.jsp
Normal file
@@ -0,0 +1,38 @@
|
||||
<%--
|
||||
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.
|
||||
--%>
|
||||
<%@ page import="org.apache.solr.core.SolrCore,
|
||||
org.apache.solr.schema.IndexSchema"%>
|
||||
<%@ page import="java.io.InputStreamReader"%>
|
||||
<%@ page import="java.io.Reader"%>
|
||||
<%@ page import="java.util.logging.Logger"%>
|
||||
<%@ page contentType="text/plain;charset=UTF-8" language="java" %>
|
||||
<%@include file="_info.jsp" %>
|
||||
<%!
|
||||
static Logger log = Logger.getLogger(SolrCore.class.getName());
|
||||
%>
|
||||
<%
|
||||
// NOTE -- this file will be removed in a future release
|
||||
log.warning("Using deprecated JSP: " + request.getRequestURL().append("?").append(request.getQueryString()) + " -- check the ShowFileRequestHandler" );
|
||||
|
||||
Reader input = new InputStreamReader(schema.getInputStream());
|
||||
char[] buf = new char[4096];
|
||||
while (true) {
|
||||
int len = input.read(buf);
|
||||
if (len<=0) break;
|
||||
out.write(buf,0,len);
|
||||
}
|
||||
%>
|
107
webapp/src/main/webapp/admin/registry.jsp
Normal file
107
webapp/src/main/webapp/admin/registry.jsp
Normal file
@@ -0,0 +1,107 @@
|
||||
<%@ page contentType="text/xml; charset=utf-8" pageEncoding="UTF-8" language="java" %>
|
||||
<%--
|
||||
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.
|
||||
--%>
|
||||
<%@ page import="org.apache.solr.core.SolrInfoMBean,
|
||||
org.apache.solr.core.SolrInfoRegistry,
|
||||
java.net.URL,
|
||||
java.util.Date,
|
||||
java.util.Map"%>
|
||||
<?xml-stylesheet type="text/xsl" href="registry.xsl"?>
|
||||
|
||||
<%@include file="_info.jsp" %>
|
||||
|
||||
<solr>
|
||||
<core><%= core.getName()%></core>
|
||||
<schema><%= collectionName %></schema>
|
||||
<host><%= hostname %></host>
|
||||
<now><%= new Date().toString() %></now>
|
||||
<start><%= new Date(core.getStartTime()) %></start>
|
||||
<solr-spec-version><%= solrSpecVersion %></solr-spec-version>
|
||||
<solr-impl-version><%= solrImplVersion %></solr-impl-version>
|
||||
<lucene-spec-version><%= luceneSpecVersion %></lucene-spec-version>
|
||||
<lucene-impl-version><%= luceneImplVersion %></lucene-impl-version>
|
||||
<solr-info>
|
||||
<%
|
||||
for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values()) {
|
||||
%>
|
||||
<<%= cat.toString() %>>
|
||||
<%
|
||||
Map<String, SolrInfoMBean> reg = core.getInfoRegistry();
|
||||
synchronized(reg) {
|
||||
for (Map.Entry<String,SolrInfoMBean> entry : reg.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
SolrInfoMBean m = entry.getValue();
|
||||
|
||||
if (m.getCategory() != cat) continue;
|
||||
|
||||
String na = "None Provided";
|
||||
String name = (m.getName()!=null ? m.getName() : na);
|
||||
String vers = (m.getVersion()!=null ? m.getVersion() : na);
|
||||
String desc = (m.getDescription()!=null ? m.getDescription() : na);
|
||||
String srcId = (m.getSourceId()!=null ? m.getSourceId() : na);
|
||||
String src = (m.getSource()!=null ? m.getSource() : na);
|
||||
// print
|
||||
%>
|
||||
<entry>
|
||||
<name>
|
||||
<%= key %>
|
||||
</name>
|
||||
<class>
|
||||
<%= name %>
|
||||
</class>
|
||||
<version>
|
||||
<%= vers %>
|
||||
</version>
|
||||
<description>
|
||||
<%= desc %>
|
||||
</description>
|
||||
<sourceid>
|
||||
<%= srcId %>
|
||||
</sourceid>
|
||||
<source>
|
||||
<%= src %>
|
||||
</source>
|
||||
|
||||
<%
|
||||
URL[] urls = m.getDocs();
|
||||
if ((urls != null) && (urls.length != 0)) {
|
||||
%>
|
||||
<urls>
|
||||
<%
|
||||
for (URL u : urls) {
|
||||
%>
|
||||
<url>
|
||||
<%= u.toString() %>
|
||||
</url>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</urls>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</entry>
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
</<%= cat.toString() %>>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</solr-info>
|
||||
</solr>
|
321
webapp/src/main/webapp/admin/registry.xsl
Normal file
321
webapp/src/main/webapp/admin/registry.xsl
Normal file
@@ -0,0 +1,321 @@
|
||||
<?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: registry.xsl 815587 2009-09-16 01:57:15Z gsingers $ -->
|
||||
<!-- $URL: https://svn.apache.org/repos/asf/lucene/solr/tags/release-1.4.1/src/webapp/web/admin/registry.xsl $ -->
|
||||
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version="1.0">
|
||||
|
||||
|
||||
<xsl:output
|
||||
method="html"
|
||||
encoding="utf-8"
|
||||
media-type="text/html; charset=UTF-8"
|
||||
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="78" width="142" src="solr_small.png" alt="SOLR">
|
||||
</img>
|
||||
</a>
|
||||
<h1>SOLR Info (<xsl:value-of select="solr/schema" />)</h1>
|
||||
<xsl:value-of select="solr/host" />
|
||||
<br clear="all" />
|
||||
<xsl:apply-templates/>
|
||||
<br /><br />
|
||||
<a href="">Return to Admin Page</a>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<H3>Category</H3>
|
||||
</td>
|
||||
<td>
|
||||
[<a href="#core">Core</a>]
|
||||
[<a href="#cache">Cache</a>]
|
||||
[<a href="#query">Query</a>]
|
||||
[<a href="#update">Update</a>]
|
||||
[<a href="#highlighting">Highlighting</a>]
|
||||
[<a href="#other">Other</a>]
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td></td>
|
||||
<td>Solr Specification Version:
|
||||
<xsl:value-of select="solr-spec-version" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td></td>
|
||||
<td>Solr Implementation Version:
|
||||
<xsl:value-of select="solr-impl-version" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td></td>
|
||||
<td>Lucene Specification Version:
|
||||
<xsl:value-of select="lucene-spec-version" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td></td>
|
||||
<td>Lucene Implementation Version:
|
||||
<xsl:value-of select="lucene-impl-version" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
Current Time: <xsl:value-of select="now" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
Server Start Time:<xsl:value-of select="start" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/*" priority="-1" />
|
||||
|
||||
<xsl:template match="solr/solr-info">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/CORE">
|
||||
<br />
|
||||
<a name="core"><h2>Core</h2></a>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">
|
||||
 
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<xsl:apply-templates/>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/CORE/entry">
|
||||
<xsl:for-each select="*">
|
||||
<tr>
|
||||
<td align="right">
|
||||
<strong><xsl:value-of select="name()"/>: </strong>
|
||||
</td>
|
||||
<td>
|
||||
<tt><xsl:value-of select="."/> </tt>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
<tr>
|
||||
<td align="right">
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/CACHE">
|
||||
<br />
|
||||
<a name="cache"><h2>Cache</h2></a>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">
|
||||
 
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<xsl:apply-templates/>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/CACHE/entry">
|
||||
<xsl:for-each select="*">
|
||||
<tr>
|
||||
<td align="right">
|
||||
<strong><xsl:value-of select="name()"/>: </strong>
|
||||
</td>
|
||||
<td>
|
||||
<tt><xsl:value-of select="."/> </tt>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
<tr>
|
||||
<td align="right">
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/QUERYHANDLER">
|
||||
<br />
|
||||
<a name="query"><h2>Query Handlers</h2></a>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">
|
||||
 
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<xsl:apply-templates/>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/QUERYHANDLER/entry">
|
||||
<xsl:for-each select="*">
|
||||
<tr>
|
||||
<td align="right">
|
||||
<strong><xsl:value-of select="name()"/>: </strong>
|
||||
</td>
|
||||
<td>
|
||||
<tt><xsl:value-of select="."/> </tt>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
<tr>
|
||||
<td align="right">
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/UPDATEHANDLER">
|
||||
<br />
|
||||
<a name="update"><h2>Update Handlers</h2></a>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">
|
||||
 
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<xsl:apply-templates/>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/UPDATEHANDLER/entry">
|
||||
<xsl:for-each select="*">
|
||||
<tr>
|
||||
<td align="right">
|
||||
<strong><xsl:value-of select="name()"/>: </strong>
|
||||
</td>
|
||||
<td>
|
||||
<tt><xsl:value-of select="."/> </tt>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
<tr>
|
||||
<td align="right">
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
<xsl:template match="solr/solr-info/HIGHLIGHTING">
|
||||
<br />
|
||||
<a name="highlighting"><h2>Highlighting</h2></a>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">
|
||||
 
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<xsl:apply-templates/>
|
||||
</table>
|
||||
</xsl:template>
|
||||
<xsl:template match="solr/solr-info/HIGHLIGHTING/entry">
|
||||
<xsl:for-each select="*">
|
||||
<tr>
|
||||
<td align="right">
|
||||
<strong><xsl:value-of select="name()"/>: </strong>
|
||||
</td>
|
||||
<td>
|
||||
<tt><xsl:value-of select="."/> </tt>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
<tr>
|
||||
<td align="right">
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="solr/solr-info/OTHER">
|
||||
<br />
|
||||
<a name="other"><h2>Other</h2></a>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">
|
||||
 
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<xsl:apply-templates/>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/OTHER/entry">
|
||||
<xsl:for-each select="*">
|
||||
<tr>
|
||||
<td align="right">
|
||||
<strong><xsl:value-of select="name()"/>: </strong>
|
||||
</td>
|
||||
<td>
|
||||
<tt><xsl:value-of select="."/> </tt>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
<tr>
|
||||
<td align="right">
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
89
webapp/src/main/webapp/admin/replication/header.jsp
Normal file
89
webapp/src/main/webapp/admin/replication/header.jsp
Normal file
@@ -0,0 +1,89 @@
|
||||
<%@ page contentType="text/html; charset=utf-8" pageEncoding="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: header.jsp 809125 2009-08-29 12:46:54Z noble $ -->
|
||||
<%@ page import="org.apache.solr.common.util.NamedList,
|
||||
org.apache.solr.common.util.SimpleOrderedMap,
|
||||
org.apache.solr.request.LocalSolrQueryRequest,
|
||||
org.apache.solr.request.SolrQueryResponse,
|
||||
org.apache.solr.request.SolrRequestHandler,
|
||||
java.util.Map"%>
|
||||
<%@ page import="org.apache.solr.handler.ReplicationHandler" %>
|
||||
<%
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<%@include file="../_info.jsp" %>
|
||||
|
||||
<script>
|
||||
var host_name="<%= hostname %>"
|
||||
</script>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="../solr-admin.css">
|
||||
<link rel="icon" href="../favicon.ico" type="image/ico" />
|
||||
<link rel="shortcut icon" href="../favicon.ico" type="image/ico" />
|
||||
<title>Solr replication admin page</title>
|
||||
<script type="text/javascript" src="../jquery-1.2.3.min.js"></script>
|
||||
|
||||
<%!
|
||||
public NamedList executeCommand(String command, SolrCore core, SolrRequestHandler rh){
|
||||
NamedList namedlist = new SimpleOrderedMap();
|
||||
namedlist.add("command", command);
|
||||
LocalSolrQueryRequest solrqreq = new LocalSolrQueryRequest(core, namedlist);
|
||||
SolrQueryResponse rsp = new SolrQueryResponse();
|
||||
core.execute(rh, solrqreq, rsp);
|
||||
namedlist = rsp.getValues();
|
||||
return namedlist;
|
||||
}
|
||||
%>
|
||||
|
||||
<%
|
||||
final Map<String,SolrRequestHandler> all = core.getRequestHandlers(ReplicationHandler.class);
|
||||
if(all.isEmpty()){
|
||||
response.sendError( 404, "No ReplicationHandler registered" );
|
||||
return;
|
||||
}
|
||||
|
||||
// :HACK: we should be more deterministic if multiple instances
|
||||
final SolrRequestHandler rh = all.values().iterator().next();
|
||||
|
||||
NamedList namedlist = executeCommand("details",core,rh);
|
||||
NamedList detailsMap = (NamedList)namedlist.get("details");
|
||||
%>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a href=".."><img border="0" align="right" height="78" width="142" src="../solr_small.png" alt="Solr"></a>
|
||||
<h1>Solr replication (<%= collectionName %>)
|
||||
|
||||
<%
|
||||
if(detailsMap != null){
|
||||
if( "true".equals(detailsMap.get("isMaster")) && "true".equals(detailsMap.get("isSlave")))
|
||||
out.println(" Master & Slave");
|
||||
else if("true".equals(detailsMap.get("isMaster")))
|
||||
out.println(" Master");
|
||||
else if("true".equals(detailsMap.get("isSlave")))
|
||||
out.println(" Slave");
|
||||
}
|
||||
%></h1>
|
||||
|
||||
<%= hostname %>:<%= port %><br/>
|
||||
cwd=<%= cwd %> SolrHome=<%= solrHome %>
|
378
webapp/src/main/webapp/admin/replication/index.jsp
Normal file
378
webapp/src/main/webapp/admin/replication/index.jsp
Normal file
@@ -0,0 +1,378 @@
|
||||
<%@ page contentType="text/html; charset=utf-8" pageEncoding="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.
|
||||
--%>
|
||||
<%@ page import="java.util.Collection" %>
|
||||
<%@ page import="java.util.Date" %>
|
||||
|
||||
|
||||
<%-- do a verbatim include so we can use the local vars --%>
|
||||
<%@include file="header.jsp"%>
|
||||
|
||||
<br clear="all" />
|
||||
(<a href="http://wiki.apache.org/solr/SolrReplication">What Is This Page?</a>)
|
||||
<br clear="all" />
|
||||
<table>
|
||||
|
||||
<%
|
||||
|
||||
final SolrCore solrcore = core;
|
||||
|
||||
%>
|
||||
<%
|
||||
NamedList slave = null, master = null;
|
||||
if (detailsMap != null)
|
||||
if ("true".equals(detailsMap.get("isSlave")))
|
||||
if(detailsMap.get("slave") != null){
|
||||
slave = (NamedList)detailsMap.get("slave");%>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Master</strong>
|
||||
</td>
|
||||
<td>
|
||||
<%=slave.get("masterUrl")%>
|
||||
<%
|
||||
NamedList nl = (NamedList) slave.get("masterDetails");
|
||||
if(nl == null)
|
||||
out.print(" - <b>Unreachable</b>");
|
||||
%>
|
||||
</td>
|
||||
</tr>
|
||||
<%
|
||||
if (nl != null) {
|
||||
nl = (NamedList) nl.get("master");
|
||||
if(nl != null){
|
||||
%>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>Latest Index Version:<%=nl.get("indexVersion")%>, Generation: <%=nl.get("generation")%>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>Replicatable Index Version:<%=nl.get("replicatableIndexVersion")%>, Generation: <%=nl.get("replicatableGeneration")%>
|
||||
</td>
|
||||
</tr>
|
||||
<%
|
||||
}
|
||||
}%>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Poll Interval</strong>
|
||||
</td>
|
||||
<td>
|
||||
<%=slave.get("pollInterval")%>
|
||||
</td>
|
||||
</tr>
|
||||
<%}%>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<strong>Local Index</strong>
|
||||
</td>
|
||||
<td>
|
||||
<%
|
||||
if (detailsMap != null)
|
||||
out.println("Index Version: " + detailsMap.get("indexVersion") + ", Generation: " + detailsMap.get("generation"));
|
||||
%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<% if (null != core.getIndexDir()) {
|
||||
File dir = new File(core.getIndexDir());
|
||||
out.println("Location: " + dir.getCanonicalPath());
|
||||
}%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><% if (detailsMap != null)
|
||||
out.println("Size: " + detailsMap.get("indexSize"));
|
||||
%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
if (detailsMap != null)
|
||||
if ("true".equals(detailsMap.get("isMaster")))
|
||||
if(detailsMap.get("master") != null){
|
||||
master = (NamedList) detailsMap.get("master");
|
||||
%>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<%out.println("Config Files To Replicate: " + master.get("confFiles"));%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<%out.println("Trigger Replication On: " + master.get("replicateAfter")); %>
|
||||
</td>
|
||||
</tr>
|
||||
<%}%>
|
||||
|
||||
<%
|
||||
if ("true".equals(detailsMap.get("isSlave")))
|
||||
if (slave != null) {%>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<%
|
||||
out.println("Times Replicated Since Startup: " + slave.get("timesIndexReplicated"));
|
||||
%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<%
|
||||
out.println("Previous Replication Done At: " + slave.get("indexReplicatedAt"));
|
||||
%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<%
|
||||
out.println("Config Files Replicated At: " + slave.get("confFilesReplicatedAt"));
|
||||
%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<%
|
||||
out.println("Config Files Replicated: " + slave.get("confFilesReplicated"));
|
||||
%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<%
|
||||
out.println("Times Config Files Replicated Since Startup: " + slave.get("timesConfigReplicated"));
|
||||
%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<%
|
||||
if (slave.get("nextExecutionAt") != null)
|
||||
if (slave.get("nextExecutionAt") != "")
|
||||
out.println("Next Replication Cycle At: " + slave.get("nextExecutionAt"));
|
||||
else if ("true".equals(slave.get("isPollingDisabled")))
|
||||
out.println("Next Replication Cycle At: Polling disabled.");
|
||||
else {
|
||||
NamedList nl1 = (NamedList) slave.get("masterDetails");
|
||||
if(nl1 != null){
|
||||
NamedList nl2 = (NamedList) nl1.get("master");
|
||||
if(nl2 != null)
|
||||
out.println("Next Replication Cycle At: After " + nl2.get("replicateAfter") + " on master.");
|
||||
}
|
||||
}
|
||||
%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
if ("true".equals(slave.get("isReplicating"))) {
|
||||
%>
|
||||
<tr>
|
||||
<td><strong>Current Replication Status</strong>
|
||||
|
||||
<td>
|
||||
<%out.println("Start Time: " + slave.get("replicationStartTime"));%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<%
|
||||
out.println("Files Downloaded: " + slave.get("numFilesDownloaded") + " / " + slave.get("numFilesToDownload"));%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<%
|
||||
out.println("Downloaded: " + slave.get("bytesDownloaded") + " / " + slave.get("bytesToDownload") + " [" + slave.get("totalPercent") + "%]");%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<%
|
||||
out.println("Downloading File: " + slave.get("currentFile") + ", Downloaded: " + slave.get("currentFileSizeDownloaded") + " / " + slave.get("currentFileSize") + " [" + slave.get("currentFileSizePercent") + "%]");%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<%
|
||||
out.println("Time Elapsed: " + slave.get("timeElapsed") + ", Estimated Time Remaining: " + slave.get("timeRemaining") + ", Speed: " + slave.get("downloadSpeed") + "/s");%>
|
||||
</td>
|
||||
</tr>
|
||||
<%}%>
|
||||
|
||||
<tr>
|
||||
<td><strong>Controls</strong>
|
||||
</td>
|
||||
<td><%
|
||||
String pollVal = request.getParameter("poll");
|
||||
if (pollVal != null)
|
||||
if (pollVal.equals("disable"))
|
||||
executeCommand("disablepoll", core, rh);
|
||||
else if (pollVal.equals("enable"))
|
||||
executeCommand("enablepoll", core, rh);
|
||||
if(slave != null)
|
||||
if ("false".equals(slave.get("isPollingDisabled"))) {
|
||||
%>
|
||||
|
||||
<form name=polling method="POST" action="./index.jsp" accept-charset="UTF-8">
|
||||
<input name="poll" type="hidden" value="disable">
|
||||
<input class="stdbutton" type="submit" value="Disable Poll">
|
||||
</form>
|
||||
|
||||
<%}%>
|
||||
<%
|
||||
if(slave != null)
|
||||
if ("true".equals(slave.get("isPollingDisabled"))) {
|
||||
%>
|
||||
|
||||
<form name=polling method="POST" action="./index.jsp" accept-charset="UTF-8">
|
||||
<input name="poll" type="hidden" value="enable">
|
||||
<input class="stdbutton" type="submit" value="Enable Poll">
|
||||
</form>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<form name=replicate method="POST" action="./index.jsp" accept-charset="UTF-8">
|
||||
<input name="replicate" type="hidden" value="now">
|
||||
<input name="replicateButton" class="stdbutton" type="submit" value="Replicate Now">
|
||||
</form>
|
||||
<%
|
||||
if(slave != null)
|
||||
if ("true".equals(slave.get("isReplicating"))) {
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
document["replicate"].replicateButton.disabled = true;
|
||||
document["replicate"].replicateButton.className = 'stdbuttondis';
|
||||
</script>
|
||||
<form name=abort method="POST" action="./index.jsp" accept-charset="UTF-8">
|
||||
<input name="abort" type="hidden" value="stop">
|
||||
<input name="abortButton" class="stdbutton" type="submit" value="Abort">
|
||||
</form>
|
||||
|
||||
<%} else {%>
|
||||
<script type="text/javascript">
|
||||
document["replicate"].replicateButton.disabled = false;
|
||||
document["replicate"].replicateButton.className = 'stdbutton';
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
String replicateParam = request.getParameter("replicate");
|
||||
String abortParam = request.getParameter("abort");
|
||||
if (replicateParam != null)
|
||||
if (replicateParam.equals("now")) {
|
||||
executeCommand("fetchindex", solrcore, rh);
|
||||
}
|
||||
if (abortParam != null)
|
||||
if (abortParam.equals("stop")) {
|
||||
executeCommand("abortfetch", solrcore, rh);
|
||||
}
|
||||
%>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<%}%>
|
||||
|
||||
<%-- List the cores (that arent this one) so we can switch --%>
|
||||
<% org.apache.solr.core.CoreContainer cores = (org.apache.solr.core.CoreContainer) request.getAttribute("org.apache.solr.CoreContainer");
|
||||
if (cores != null) {
|
||||
Collection<String> names = cores.getCoreNames();
|
||||
if (names.size() > 1) {%>
|
||||
<tr>
|
||||
<td><strong>Cores:</strong><br></td>
|
||||
<td><%
|
||||
for (String name : names) {
|
||||
%>[<a href="../../../<%=name%>/admin/index.jsp"><%=name%>
|
||||
</a>]<%
|
||||
}%></td>
|
||||
</tr>
|
||||
<%
|
||||
}
|
||||
}%>
|
||||
|
||||
|
||||
</table>
|
||||
<P>
|
||||
|
||||
<p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
Current Time: <%= new Date() %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
Server Start At: <%= new Date(core.getStartTime()) %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<a href="..">Return to Admin Page</a>
|
||||
</body>
|
||||
</html>
|
657
webapp/src/main/webapp/admin/schema.jsp
Normal file
657
webapp/src/main/webapp/admin/schema.jsp
Normal file
@@ -0,0 +1,657 @@
|
||||
<%@ page contentType="text/html; charset=utf-8" pageEncoding="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: index.jsp 608150 2008-01-02 17:15:30Z ryan $ --%>
|
||||
<%-- $Source: /cvs/main/searching/SolrServer/resources/admin/index.jsp,v $ --%>
|
||||
<%-- $Name: $ --%>
|
||||
|
||||
<script src="jquery-1.2.3.min.js"></script>
|
||||
<script>
|
||||
|
||||
(function($, libName) {
|
||||
var solr = {
|
||||
|
||||
//The default location of the luke handler relative to this page
|
||||
// Can be overridden in the init(url) method
|
||||
pathToLukeHandler: 'luke',
|
||||
|
||||
// Base properties to hold schema information
|
||||
schemaInfo: {},
|
||||
schemaFields: {},
|
||||
schemaDynamicFields: {},
|
||||
schemaTypes: {},
|
||||
schemaFlags: {},
|
||||
|
||||
//The basic function to call to make the initail JSON calls
|
||||
// takes one option parameter, the path to the luke handler
|
||||
// if undefined, it will use the default, 'luke', which means
|
||||
// this is being called from the same relative URL path
|
||||
init: function(pathToLukeHandler) {
|
||||
if (pathToLukeHandler != undefined) {
|
||||
solr.pathToLukeHandler = pathToLukeHandler;
|
||||
}
|
||||
solr.loadSchema(function() {
|
||||
solr.loadFromLukeHandler(function () {
|
||||
solr.createMenu('menu');
|
||||
solr.displaySchemaInfo();
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
//load the Schema from the LukeRequestHandler
|
||||
// this loads every field, and in each field the copy source/dests and flags
|
||||
// we also load the list of field types, and the list of flags
|
||||
loadSchema: function(func) {
|
||||
$.getJSON(solr.pathToLukeHandler +'?show=schema&wt=json', function(data) {
|
||||
//populate all non field/type/flag data in the info block
|
||||
$.each(data.index, function(i, item) {
|
||||
solr.schemaInfo[i] = item;
|
||||
});
|
||||
|
||||
//LukeRequestHandler places these two attributes outside of the "index" node, but
|
||||
// we want it here so we can more easily display it in the "HOME" block
|
||||
solr.schemaInfo['uniqueKeyField'] = data.schema.uniqueKeyField;
|
||||
solr.schemaInfo['defaultSearchField'] = data.schema.defaultSearchField;
|
||||
//a one-off hack, because the directory string is so long and unbroken
|
||||
// that it can break CSS layouts
|
||||
solr.schemaInfo['directory'] = solr.schemaInfo['directory'].substring(0, solr.schemaInfo['directory'].indexOf('@')+1) + ' ' + solr.schemaInfo['directory'].substring(solr.schemaInfo['directory'].indexOf('@') +1);
|
||||
|
||||
// populate the list of fields
|
||||
$.each(data.schema.fields, function(i,item){
|
||||
solr.schemaFields[i]=item;
|
||||
});
|
||||
// populate the list of field types
|
||||
$.each(data.schema.types, function(type, ft) {
|
||||
solr.schemaTypes[type] = ft;
|
||||
});
|
||||
//populate the list of dynamic fields
|
||||
$.each(data.schema.dynamicFields, function(i, dynField) {
|
||||
solr.schemaDynamicFields[i] = dynField;
|
||||
});
|
||||
//populate the list of flags, so we can convert flags to text in display
|
||||
$.each(data.info.key, function(i, flag) {
|
||||
solr.schemaFlags[i] = flag;
|
||||
});
|
||||
|
||||
//LukeRequestHandler returns copyFields src/dest as the entire toString of the field
|
||||
// we only need the field name, so here we loop through the fields, and replace the full
|
||||
// field definitions with the name in the copySources/copyDests properties
|
||||
$.each(solr.schemaFields, function(i, field) {
|
||||
$.each(['copySources', 'copyDests'], function(i, copyProp) {
|
||||
var newFields = new Array();
|
||||
$.each(field[copyProp], function(i, fullName) {
|
||||
newFields.push(fullName.substring(fullName.lastIndexOf(':')+1, fullName.indexOf('{')));
|
||||
});
|
||||
field[copyProp] = newFields;
|
||||
});
|
||||
|
||||
});
|
||||
//An additional optional callback
|
||||
// used in init to trigger the 2nd call to LukeRequestHandler only
|
||||
// after the first one is finished
|
||||
if ($.isFunction(func)) {
|
||||
func(solr);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//further populates the loaded schema with information gathered
|
||||
// from the no argument LukeRequestHandler
|
||||
loadFromLukeHandler: function(func) {
|
||||
$.getJSON(solr.pathToLukeHandler+'?wt=json', function(data) {
|
||||
$.each(data.fields, function(i, item) {
|
||||
var field = solr.schemaFields[i];
|
||||
|
||||
//If undefined, then we have a dynamicField which does not show up
|
||||
// in the LukeRequestHandler show=schema variant
|
||||
if (field == undefined) {
|
||||
field = item;
|
||||
//Attach this field to its dynamicField
|
||||
var base = field.dynamicBase;
|
||||
var dynField = solr.schemaDynamicFields[base];
|
||||
|
||||
//Some fields in a multicore setting have no dynamic base, either
|
||||
// the name of the core is a field that has no type or flags
|
||||
if (dynField != undefined) {
|
||||
var synFields = dynField['fields'];
|
||||
if (synFields== undefined) {
|
||||
synFields= new Array();
|
||||
}
|
||||
synFields.push(i);
|
||||
dynField['fields'] = synFields;
|
||||
}
|
||||
solr.schemaFields[i] = item;
|
||||
}
|
||||
//Populate other data in this field that would not have been loaded in
|
||||
// the show=schema variant
|
||||
$.each(item, function(k, v) {
|
||||
if (k == 'topTerms' || k == 'histogram') {
|
||||
solr.schemaFields[i][k] = solr.lukeArrayToHash(v);
|
||||
} else {
|
||||
solr.schemaFields[i][k] = v;
|
||||
}
|
||||
});
|
||||
});
|
||||
//another optional callback; used in the init case to lay out the page
|
||||
// after the data is loaded
|
||||
if ($.isFunction(func)) {
|
||||
func();
|
||||
}
|
||||
});
|
||||
},
|
||||
//some elements in the JSON response are arrays, where odd/even elements
|
||||
// are the name/value, and convert it to a standard map/associative array
|
||||
// incoming: ['foo', 'bar', 'bat', 'baz']
|
||||
// output: {'foo':'bar', 'bat':baz'}
|
||||
lukeArrayToHash: function(termsArr) {
|
||||
var hash = new Object();
|
||||
var temp;
|
||||
//topTerms comes in as an array, with odd indexes the field name
|
||||
// and even indexes the number
|
||||
$.each(termsArr, function(i, item) {
|
||||
if (i%2 ==0) {
|
||||
temp = item;
|
||||
} else {
|
||||
hash[temp] = item;
|
||||
}
|
||||
});
|
||||
return hash;
|
||||
},
|
||||
|
||||
//gets the top Terms via an Ajax call the LukeRequestHandler for that field
|
||||
// The callback is used here to redraw the table after the ajax call returns
|
||||
getTopTerms: function(fieldName, numTerms, func) {
|
||||
if (numTerms == undefined) {
|
||||
var numTerms = 10;
|
||||
}
|
||||
if (isNaN(numTerms) || numTerms <=0 || numTerms.indexOf('.') != -1) {
|
||||
return;
|
||||
}
|
||||
$.getJSON(solr.pathToLukeHandler+'?fl='+fieldName+'&wt=json&numTerms='+numTerms, function(data) {
|
||||
solr.schemaFields[fieldName]['topTerms'] = solr.lukeArrayToHash(data.fields[fieldName].topTerms);
|
||||
if ($.isFunction(func)) {
|
||||
func(solr.schemaFields[fieldName]['topTerms'], fieldName);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Displays the SchemaInfo in the main content panel
|
||||
// dispayed on data load, and also when 'Home' is clicked
|
||||
displaySchemaInfo: function() {
|
||||
$('#mainInfo').html('');
|
||||
$('#topTerms').html('');
|
||||
$('#histogram').html('');
|
||||
$('#mainInfo').append(solr.createSimpleText('Schema Information'));
|
||||
//Make sure the uniqueKeyField and defaultSearchFields come first
|
||||
$.each({'Unique Key':'uniqueKeyField', 'Default Search Field':'defaultSearchField'}, function(text, prop) {
|
||||
if (solr.schemaInfo[prop] != undefined) {
|
||||
$('#mainInfo').append(solr.createNameValueText(text, function(p) {
|
||||
p.appendChild(solr.createLink(solr.schemaInfo[prop], solr.schemaInfo[prop]));
|
||||
return p;
|
||||
}));
|
||||
}
|
||||
});
|
||||
$.each(solr.schemaInfo, function(i, item) {
|
||||
if (i == 'uniqueKeyField' || i == 'defaultSearchField') {
|
||||
//noop; we took care of this above
|
||||
} else {
|
||||
$('#mainInfo').append(solr.createNameValueText(i, item));
|
||||
}
|
||||
});
|
||||
//Close all menus when we display schema home
|
||||
solr.toggleMenus(undefined, ['fields', 'types', 'dynFields']);
|
||||
},
|
||||
|
||||
// display a dynamic field in the main content panel
|
||||
displayDynamicField: function(dynamicPattern) {
|
||||
var df = solr.schemaDynamicFields[dynamicPattern];
|
||||
$('#mainInfo').html('');
|
||||
$('#topTerms').html('');
|
||||
$('#histogram').html('');
|
||||
$('#mainInfo').append(solr.createSimpleText('Dynamic Field: ' + dynamicPattern));
|
||||
$('#mainInfo').append(solr.createNameValueText('Fields', function(p) {
|
||||
if (df.fields != undefined) {
|
||||
$.each(df.fields, function(i, item) {
|
||||
p.appendChild(solr.createLink(item, item));
|
||||
});
|
||||
} else {
|
||||
p.appendChild(document.createTextNode(' None currently in index'));
|
||||
}
|
||||
return p;
|
||||
}));
|
||||
var ft = solr.schemaTypes[df.type];
|
||||
$('#mainInfo').append(solr.createNameValueText('Field Type', function(p) {
|
||||
p.appendChild(solr.createLink(df.type, df.type, solr.displayFieldType));
|
||||
return p;
|
||||
}));
|
||||
if (df.flags != undefined) {
|
||||
$('#mainInfo').append(solr.createNameValueText('Properties', solr.createTextFromFlags(df.flags, df.type)));
|
||||
}
|
||||
solr.displayAnalyzer(ft.indexAnalyzer, 'Index Analyzer', true);
|
||||
solr.displayAnalyzer(ft.queryAnalyzer, 'Query Analyzer', true);
|
||||
|
||||
solr.toggleMenus('dynFields', ['fields', 'types'], dynamicPattern);
|
||||
},
|
||||
|
||||
// display a field type in the main area
|
||||
displayFieldType: function(typeName) {
|
||||
var ft = solr.schemaTypes[typeName];
|
||||
$('#mainInfo').html('');
|
||||
$('#topTerms').html('');
|
||||
$('#histogram').html('');
|
||||
$('#mainInfo').append(solr.createSimpleText('Field Type: ' + typeName));
|
||||
$('#mainInfo').append(solr.createNameValueText('Fields', function(p) {
|
||||
if (ft.fields != undefined) {
|
||||
$.each(ft.fields, function(i, item) {
|
||||
if (solr.schemaFields[item] != undefined) {
|
||||
p.appendChild(solr.createLink(item, item));
|
||||
} else {
|
||||
p.appendChild(solr.createLink(item, item, solr.displayDynamicField));
|
||||
}
|
||||
p.appendChild(document.createTextNode(' '));
|
||||
});
|
||||
} else {
|
||||
p.appendChild(document.createTextNode('No fields in index'));
|
||||
}
|
||||
return p;
|
||||
}));
|
||||
$('#mainInfo').append(solr.createNameValueText('Tokenized', ft.tokenized));
|
||||
$('#mainInfo').append(solr.createNameValueText('Class Name', ft.className));
|
||||
|
||||
solr.displayAnalyzer(ft.indexAnalyzer, 'Index Analyzer');
|
||||
solr.displayAnalyzer(ft.queryAnalyzer, 'Query Analyzer');
|
||||
solr.toggleMenus('types', ['fields', 'dynFields'], typeName);
|
||||
},
|
||||
|
||||
//Displays information about an Analyzer in the main content area
|
||||
displayAnalyzer: function(analyzer, type, shouldCollapse) {
|
||||
var tid = type.replace(' ', '');
|
||||
var collapse = shouldCollapse && (analyzer.tokenizer != undefined || analyzer.filters != undefined);
|
||||
$('#mainInfo').append(solr.createNameValueText(type, function(p) {
|
||||
p.appendChild(document.createTextNode(analyzer.className + ' '));
|
||||
if (collapse) {
|
||||
p.appendChild(solr.createLink(type, 'Details', function() {
|
||||
$('#'+tid).toggle("slow");
|
||||
}));
|
||||
}
|
||||
return p;
|
||||
}));
|
||||
var adiv = document.createElement('div');
|
||||
adiv.id=tid;
|
||||
adiv.className='analyzer';
|
||||
if (collapse) {
|
||||
adiv.style.display='none';
|
||||
}
|
||||
if (analyzer.tokenizer != undefined) {
|
||||
adiv.appendChild(solr.createNameValueText("Tokenizer Class", analyzer.tokenizer.className));
|
||||
}
|
||||
if (analyzer.filters != undefined) {
|
||||
adiv.appendChild(solr.createNameValueText('Filters', ''));
|
||||
var f = document.createElement('ol');
|
||||
$.each(analyzer.filters, function(i, item) {
|
||||
var fil = document.createElement('li');
|
||||
var filterText = item.className;
|
||||
if (item.args != undefined) {
|
||||
filterText += ' args:{'
|
||||
$.each(item.args, function(fi, fitem) {
|
||||
filterText += fi + ': ' + fitem + ' ';
|
||||
});
|
||||
filterText +='}';
|
||||
fil.innerHTML = filterText;
|
||||
f.appendChild(fil);
|
||||
}
|
||||
});
|
||||
adiv.appendChild(f);
|
||||
}
|
||||
$('#mainInfo').append(adiv);
|
||||
},
|
||||
|
||||
// display information about a Field in the main content area
|
||||
// and its TopTerms and Histogram in related divs
|
||||
displayField: function(fieldName) {
|
||||
var field = solr.schemaFields[fieldName];
|
||||
var isDynamic = field.dynamicBase != undefined ? true : false;
|
||||
var ft;
|
||||
var ftName;
|
||||
$('#mainInfo').html('');
|
||||
$('#topTerms').html('');
|
||||
$('#histogram').html('');
|
||||
$('#mainInfo').append(solr.createSimpleText('Field: ' + fieldName));
|
||||
|
||||
//For regular fields, we take their properties; for dynamicFields,
|
||||
// we take them from their dynamicField definitions
|
||||
if (isDynamic) {
|
||||
ftName = solr.schemaDynamicFields[field.dynamicBase].type
|
||||
$('#mainInfo').append(solr.createNameValueText('Dynamically Created From Pattern', function(p) {
|
||||
p.appendChild(solr.createLink(field.dynamicBase, field.dynamicBase, solr.displayDynamicField));
|
||||
return p;
|
||||
}));
|
||||
} else {
|
||||
ftName = field.type;
|
||||
}
|
||||
ft = solr.schemaTypes[field.type];
|
||||
$('#mainInfo').append(solr.createNameValueText('Field Type', function(p) {
|
||||
p.appendChild(solr.createLink(ftName, ftName, solr.displayFieldType));
|
||||
return p;
|
||||
}));
|
||||
if (solr.schemaFlags != '') {
|
||||
$.each({'flags':'Properties', 'schema':'Schema', 'index':'Index'}, function(prop, text) {
|
||||
if (field[prop] != undefined) {
|
||||
$('#mainInfo').append(solr.createNameValueText(text, solr.createTextFromFlags(field[prop], ft)));
|
||||
}
|
||||
});
|
||||
}
|
||||
$.each({'copySources':'Copied From', 'copyDests':'Copied Into'}, function(prop, text) {
|
||||
if (field[prop] != undefined && field[prop] != '') {
|
||||
$('#mainInfo').append(solr.createNameValueText(text, function(p) {
|
||||
$.each(field[prop], function(i, item) {
|
||||
p.appendChild(solr.createLink(item, item));
|
||||
p.appendChild(document.createTextNode(' '));
|
||||
});
|
||||
return p;
|
||||
}));
|
||||
}
|
||||
});
|
||||
if (field.positionIncrementGap != undefined) {
|
||||
$('#mainInfo').append(solr.createNameValueText('Position Increment Gap', field.positionIncrementGap));
|
||||
}
|
||||
solr.displayAnalyzer(ft.indexAnalyzer, 'Index Analyzer', true);
|
||||
solr.displayAnalyzer(ft.queryAnalyzer, 'Query Analyzer', true);
|
||||
if (field.docs != undefined) {
|
||||
$('#mainInfo').append(solr.createNameValueText('Docs', field.docs));
|
||||
}
|
||||
if (field.distinct != undefined) {
|
||||
$('#mainInfo').append(solr.createNameValueText('Distinct', field.distinct));
|
||||
}
|
||||
|
||||
if (field.topTerms != undefined) {
|
||||
solr.displayTopTerms(field.topTerms, fieldName);
|
||||
}
|
||||
|
||||
if (field.histogram != undefined) {
|
||||
solr.drawHistogram(field.histogram);
|
||||
}
|
||||
solr.toggleMenus('fields', ['types', 'dynFields'], fieldName);
|
||||
},
|
||||
|
||||
//utility method to create a single sentence list of properties from a flag set
|
||||
// or pass it on, if the flags are (unstored field)
|
||||
createTextFromFlags: function(fieldFlags, fieldType) {
|
||||
var value;
|
||||
if (fieldFlags != '(unstored field)') {
|
||||
var value = '';
|
||||
for (var i=0;i<fieldFlags.length;i++) {
|
||||
if (fieldFlags.charAt(i) != '-') {
|
||||
value += solr.schemaFlags[fieldFlags.charAt(i)];
|
||||
value += ', ';
|
||||
}
|
||||
}
|
||||
value = value.substring(0, value.length-2);
|
||||
} else {
|
||||
value = fieldFlags;
|
||||
}
|
||||
return value;
|
||||
},
|
||||
|
||||
//Store the currently highlighted menu item, as otherwise we
|
||||
// must traverse all li menu items, which is very slow on schemas with
|
||||
// large number of fields
|
||||
// for example $('#menu ul li').siblings().removeClass('selected');
|
||||
currentlyHighlightedMenuId: undefined,
|
||||
|
||||
//add a highlight to the currently selected menu item, and remove
|
||||
// the highlights from all other menu items
|
||||
highlightMenuItem: function(idToSelect) {
|
||||
if (solr.currentlyHighlightedMenuId != undefined) {
|
||||
$('#'+solr.currentlyHighlightedMenuId).removeClass('selected');
|
||||
}
|
||||
$('#'+idToSelect).addClass('selected');
|
||||
solr.currentlyHighlightedMenuId = idToSelect;
|
||||
},
|
||||
|
||||
//Opens one menu group, close the others, and optionally highlight one
|
||||
// item, which should be in the opened menu
|
||||
toggleMenus: function(idToShow, idsToHide, idToSelect) {
|
||||
if (idToSelect != undefined) {
|
||||
solr.highlightMenuItem(idToShow + idToSelect);
|
||||
}
|
||||
$('#'+idToShow).show("slow");
|
||||
$.each(idsToHide, function(i, idToHide) {
|
||||
$('#'+idToHide).hide("slow");
|
||||
});
|
||||
},
|
||||
|
||||
//A utility method to create a paragraph, which takes two arguments;
|
||||
// an opening text, and either text or a callback function to follow
|
||||
// any callback function must return the node passed into it
|
||||
createNameValueText: function(openingText, func) {
|
||||
var p = document.createElement('p');
|
||||
p.appendChild(solr.createSimpleText(openingText + ': ', 'b'));
|
||||
return solr.applyFuncToNode(p, func);
|
||||
},
|
||||
|
||||
//utility method to create an HTML text element node
|
||||
// with the literal text to place, and an optional function to apply
|
||||
// any callback function must return the node passed into it
|
||||
createSimpleText: function(text, n, func) {
|
||||
if (n == undefined) {
|
||||
n = 'h2';
|
||||
}
|
||||
var no= document.createElement(n);
|
||||
no.appendChild(document.createTextNode(text));
|
||||
return solr.applyFuncToNode(no, func);
|
||||
},
|
||||
|
||||
//Utility method that applies a function or a string to append
|
||||
// an additional child to a node
|
||||
applyFuncToNode: function(no, func) {
|
||||
if ($.isFunction(func)) {
|
||||
no = func(no);
|
||||
} else {
|
||||
// if it is not a function, append it as a string
|
||||
if (func != undefined) {
|
||||
no.appendChild(document.createTextNode(' ' + func));
|
||||
}
|
||||
}
|
||||
return no;
|
||||
},
|
||||
|
||||
//show a table of top terms for a given field
|
||||
displayTopTerms: function(topTerms, fieldName) {
|
||||
$('#topTerms').html('');
|
||||
var tbl = document.createElement('table');
|
||||
tbl.className='topTerms';
|
||||
var thead= document.createElement('thead');
|
||||
var headerRow = document.createElement('tr');
|
||||
$.each(['term', 'frequency'], function() {
|
||||
var cell = document.createElement('th');
|
||||
cell.innerHTML= this;
|
||||
headerRow.appendChild(cell);
|
||||
});
|
||||
thead.appendChild(headerRow);
|
||||
tbl.appendChild(thead);
|
||||
var tbody = document.createElement('tbody');
|
||||
|
||||
var numTerms = 0;
|
||||
$.each(topTerms, function(term, count) {
|
||||
var c1 = $('<td>').text(term);
|
||||
var c2 = $('<td>').text(count);
|
||||
var row = $('<tr>').append(c1).append(c2);
|
||||
tbody.appendChild(row.get(0));
|
||||
numTerms++;
|
||||
});
|
||||
tbl.appendChild(tbody);
|
||||
|
||||
//create a header along with an input widget so the user
|
||||
// can request a different number of Top Terms
|
||||
var h2 = document.createElement('h2');
|
||||
h2.appendChild(document.createTextNode('Top '));
|
||||
var termsGetter = document.createElement('input');
|
||||
termsGetter.type='text';
|
||||
termsGetter.size=5;
|
||||
termsGetter.value=numTerms;
|
||||
|
||||
termsGetter.onchange=function() {
|
||||
solr.getTopTerms(fieldName, this.value, solr.displayTopTerms);
|
||||
}
|
||||
h2.appendChild(termsGetter);
|
||||
h2.appendChild(document.createTextNode(' Terms'));
|
||||
$('#topTerms').append(h2);
|
||||
|
||||
document.getElementById('topTerms').appendChild(tbl);
|
||||
$('#topTerms').append(tbl);
|
||||
},
|
||||
|
||||
//draws a histogram, taking a map of values and an optional total height and width for the table
|
||||
drawHistogram: function(histogram, totalHeightArg, totalWidthArg) {
|
||||
$('#histogram').html('');
|
||||
$('#histogram').append(solr.createSimpleText('Histogram'));
|
||||
var max = 0;
|
||||
var bars =0;
|
||||
//find the # of columns and max value in the histogram
|
||||
// so we can create an appropriately scaled chart
|
||||
$.each(histogram, function(i, item) {
|
||||
if (item > max) max = item;
|
||||
bars += 1;
|
||||
});
|
||||
if (max ==0) {
|
||||
$('#histogram').append(solr.createNameValueText('No histogram available'));
|
||||
} else {
|
||||
var totalHeight = totalHeightArg == undefined ? 208 : totalHeightArg;
|
||||
var totalWidth = totalWidthArg == undefined ? 160 : totalWidthArg;
|
||||
var tbl = document.createElement('table');
|
||||
tbl.style.width=totalWidth+'px';
|
||||
tbl.className = 'histogram';
|
||||
var h = document.createElement('tbody');
|
||||
var r = document.createElement('tr');
|
||||
var r2 = document.createElement('tr');
|
||||
$.each(histogram, function(i, item) {
|
||||
var c = document.createElement('td');
|
||||
c.innerHTML=item+'<div style="width:'+totalWidth/bars+'px;height:'+(item*totalHeight/max)+'px;background:blue"> </div>';
|
||||
r.appendChild(c);
|
||||
var c2 = document.createElement('td');
|
||||
c2.innerHTML='' + i;
|
||||
r2.appendChild(c2);
|
||||
});
|
||||
h.appendChild(r);
|
||||
h.appendChild(r2);
|
||||
tbl.appendChild(h);
|
||||
$('#histogram').append(tbl);
|
||||
}
|
||||
},
|
||||
|
||||
//dynamically creates a link to be appended
|
||||
createLink: function(idToDisplay, linkText, linkFunction) {
|
||||
var link = document.createElement('a');
|
||||
if (!$.isFunction(linkFunction)) {
|
||||
linkFunction = solr.displayField
|
||||
}
|
||||
link.onclick=function() {
|
||||
linkFunction(idToDisplay);
|
||||
return false;
|
||||
};
|
||||
link.href='#';
|
||||
link.innerHTML=linkText;
|
||||
return link;
|
||||
},
|
||||
|
||||
//Creates a menu header that can expand or collapse its children
|
||||
createMenuHeader: function(text, idToShow, idsToHide) {
|
||||
var head = document.createElement('h3');
|
||||
var a = document.createElement('a');
|
||||
a.onclick=function() {
|
||||
solr.toggleMenus(idToShow, idsToHide);
|
||||
return false;
|
||||
};
|
||||
a.href='#';
|
||||
a.innerHTML=text;
|
||||
head.appendChild(a);
|
||||
return head;
|
||||
},
|
||||
|
||||
//Creates an element in a menu (e.g. each field in a list of fields)
|
||||
createMenuItem: function(tagName, text, link, type, func) {
|
||||
var fieldEle = document.createElement('li');
|
||||
fieldEle.id=type+text;
|
||||
var funct = func == undefined ? undefined : func;
|
||||
fieldEle.appendChild(solr.createLink(text, link, funct));
|
||||
return fieldEle;
|
||||
},
|
||||
|
||||
//populates the menu div
|
||||
createMenu: function(menuId) {
|
||||
var m = $('#'+menuId);
|
||||
var home = document.createElement('h2');
|
||||
home.appendChild(solr.createLink('Home', 'Home', solr.displaySchemaInfo));
|
||||
m.append(home);
|
||||
m.append(solr.createMenuHeader('Fields', 'fields', ['types', 'dynFields']));
|
||||
var fields= document.createElement('ul');
|
||||
fields.style.display='none';
|
||||
fields.id = 'fields';
|
||||
$.each(solr.schemaFields, function(i, item) {
|
||||
fields.appendChild(solr.createMenuItem('li', i, i, fields.id));
|
||||
});
|
||||
m.append(fields);
|
||||
m.append(solr.createMenuHeader('Dynamic Fields', 'dynFields', ['fields', 'types']));
|
||||
var dyns = document.createElement('ul');
|
||||
dyns.style.display = 'none';
|
||||
dyns.id = 'dynFields';
|
||||
$.each(solr.schemaDynamicFields, function(i, item) {
|
||||
dyns.appendChild(solr.createMenuItem('li', i,i, dyns.id, solr.displayDynamicField));
|
||||
});
|
||||
m.append(dyns);
|
||||
m.append(solr.createMenuHeader('Field Types', 'types', ['fields', 'dynFields']));
|
||||
var types = document.createElement('ul');
|
||||
types.style.display='none';
|
||||
types.id='types';
|
||||
$.each(this.schemaTypes, function(i, item) {
|
||||
types.appendChild(solr.createMenuItem('li', i, i,types.id, solr.displayFieldType));
|
||||
});
|
||||
m.append(types);
|
||||
}
|
||||
};
|
||||
|
||||
window[libName] = solr;
|
||||
})(jQuery, 'solr');
|
||||
$(document).ready(function() {
|
||||
solr.init();
|
||||
});
|
||||
|
||||
$(window).unload( function() {
|
||||
solr = null;
|
||||
$('#mainInfo').html('');
|
||||
$('#menu').html('');
|
||||
$('#topTerms').html('');
|
||||
$('#histogram').html('');
|
||||
});
|
||||
|
||||
</script>
|
||||
<%-- do a verbatim include so we can use the local vars --%>
|
||||
<%@include file="header.jsp" %>
|
||||
<div id="schemaTop">
|
||||
<h2>Schema Browser | See <a href="file/?file=schema.xml">Raw Schema.xml</a></h2>
|
||||
</div>
|
||||
<div id="menu"></div>
|
||||
<div id="content">
|
||||
<div id="mainInfo"><h2>Please wait...loading and parsing Schema Information from LukeRequestHandler</h2><p>If it does not load or your browser is not javascript or ajax-capable, you may wish to examine your schema using the <a href="luke?wt=xslt&tr=luke.xsl">Server side transformed LukeRequestHandler</a> or the raw <a href="file/?file=schema.xml">schema.xml</a> instead.</div>
|
||||
<div id="topTerms"></div>
|
||||
<div id="histogram"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
215
webapp/src/main/webapp/admin/solr-admin.css
Normal file
215
webapp/src/main/webapp/admin/solr-admin.css
Normal file
@@ -0,0 +1,215 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
h1, h2, h3, h4, h5 {
|
||||
display: block;
|
||||
font-family: ITC Officina Sans Book, Terminator Two, Helvetica, Arial, sans-serif;
|
||||
font-style: bold;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-family: ITC Officina Sans Book, Terminator Two, Helvetica, Arial, sans-serif;
|
||||
font-style: bold;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
input.std, textarea.std {
|
||||
color: black;
|
||||
border: 2px inset #ff9933;
|
||||
background-color: #ffffff;
|
||||
width:450px;
|
||||
max-width:450px;
|
||||
}
|
||||
|
||||
input.stdbutton {
|
||||
font-family: ITC Officina Sans Book, Helvetica, Arial, sans-serif;
|
||||
font-style: bold;
|
||||
font-size: 11;
|
||||
text-transform: capitalize;
|
||||
color: black;
|
||||
background-color: #dddddd;
|
||||
border: groove #ff9933;
|
||||
}
|
||||
|
||||
input.stdbutton:hover {
|
||||
color: #0000ff;
|
||||
border: groove #0000ff;
|
||||
}
|
||||
|
||||
input.stdbuttondis{
|
||||
font-family: ITC Officina Sans Book, Helvetica, Arial, sans-serif;
|
||||
font-style: bold;
|
||||
font-size: 11;
|
||||
text-transform: capitalize;
|
||||
color: #8B8B83;
|
||||
background-color: #dddddd;
|
||||
border: groove #8B8B83;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #bbbbbb;
|
||||
}
|
||||
|
||||
table {
|
||||
display: table;
|
||||
background-color: #FAF7E4;
|
||||
width: 100%;
|
||||
border-top: 4px solid #666666;
|
||||
border-left: 2px solid #666666;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
cellpadding-right: 8px;
|
||||
}
|
||||
|
||||
table.responseHeader, table.analysis {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse
|
||||
}
|
||||
|
||||
tr > td:first-child {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
td.debugdata, td.highlight, td.responseHeader {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
td.highlight {
|
||||
background: #ccccff;
|
||||
}
|
||||
|
||||
td.responseHeader {
|
||||
width: auto;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
td.responseHeader + td {
|
||||
text-align: left;
|
||||
font-family: Courier;
|
||||
}
|
||||
|
||||
|
||||
th, td {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
border-bottom: 1px solid #ff9933;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
font-size: 11px;
|
||||
background: #FAF7E4;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
a:link {
|
||||
color: #0000aa;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: #0000ff;
|
||||
}
|
||||
|
||||
a:active {
|
||||
color: #4444ff;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #0000ff;
|
||||
background: #ccccff;
|
||||
}
|
||||
|
||||
a:offsite {
|
||||
color: #0000aa;
|
||||
}
|
||||
|
||||
table.analysis th, table.analysis td {
|
||||
border-right:1px solid black;
|
||||
}
|
||||
|
||||
/**
|
||||
* styles for the schema browser
|
||||
*/
|
||||
|
||||
table.topTerms {
|
||||
width: 450px;
|
||||
}
|
||||
|
||||
table.histogram {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
table.histogram td, table.histogram th {
|
||||
text-align: center;
|
||||
vertical-align: bottom;
|
||||
border-bottom: 1px solid #ff9933;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#menu {
|
||||
background-color: #FAF7E4;
|
||||
height:100%;
|
||||
min-height:100%;
|
||||
width:140px;
|
||||
float:left;
|
||||
margin-right:20px
|
||||
}
|
||||
#menu h3 {
|
||||
padding-left:10px;
|
||||
}
|
||||
#menu ul {
|
||||
list-style: none;
|
||||
text-align: right;
|
||||
margin: 0;
|
||||
padding: 0
|
||||
}
|
||||
#menu li.header {
|
||||
text-align: left;
|
||||
}
|
||||
#menu li {
|
||||
border: 1px solid #ff9933;
|
||||
margin: 0
|
||||
}
|
||||
#menu li a {
|
||||
display:block;
|
||||
}
|
||||
#menu li.selected a {
|
||||
background-color: #ccccff
|
||||
}
|
||||
#menu a:hover {
|
||||
background: #ccccff
|
||||
}
|
||||
|
||||
#schemaTop {
|
||||
border-bottom:1px black solid;
|
||||
}
|
||||
|
||||
#content {
|
||||
margin-left: 160px;
|
||||
}
|
||||
#topTerms {
|
||||
float:left;
|
||||
margin-right:40px;
|
||||
}
|
||||
div.analyzer {
|
||||
margin-left:20px;
|
||||
}
|
BIN
webapp/src/main/webapp/admin/solr_small.png
Normal file
BIN
webapp/src/main/webapp/admin/solr_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
92
webapp/src/main/webapp/admin/stats.jsp
Normal file
92
webapp/src/main/webapp/admin/stats.jsp
Normal file
@@ -0,0 +1,92 @@
|
||||
<%@ page contentType="text/xml; charset=utf-8" pageEncoding="UTF-8" language="java" %>
|
||||
<%--
|
||||
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.
|
||||
--%>
|
||||
<%@ page import="org.apache.solr.core.SolrInfoMBean,
|
||||
org.apache.solr.core.SolrInfoRegistry,
|
||||
org.apache.solr.common.util.NamedList,
|
||||
java.util.Date,
|
||||
java.util.Map"%>
|
||||
<?xml-stylesheet type="text/xsl" href="stats.xsl"?>
|
||||
<%@include file="_info.jsp" %>
|
||||
|
||||
|
||||
<solr>
|
||||
<%
|
||||
if (core.getName() != null) { %>
|
||||
<core><% XML.escapeCharData(core.getName(), out); %></core>
|
||||
<% } %>
|
||||
<schema><% XML.escapeCharData(collectionName, out); %></schema>
|
||||
<host><% XML.escapeCharData(hostname, out); %></host>
|
||||
<now><% XML.escapeCharData(new Date().toString(), out); %></now>
|
||||
<start><% XML.escapeCharData(new Date(core.getStartTime()).toString(), out); %></start>
|
||||
<solr-info>
|
||||
<%
|
||||
for (SolrInfoMBean.Category cat : SolrInfoMBean.Category.values()) {
|
||||
%>
|
||||
<<%= cat.toString() %>>
|
||||
<%
|
||||
Map<String,SolrInfoMBean> reg = core.getInfoRegistry();
|
||||
for (Map.Entry<String,SolrInfoMBean> entry : reg.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
SolrInfoMBean m = entry.getValue();
|
||||
|
||||
if (m.getCategory() != cat) continue;
|
||||
|
||||
NamedList nl = m.getStatistics();
|
||||
if ((nl != null) && (nl.size() != 0)) {
|
||||
String na = "None Provided";
|
||||
String name = (m.getName()!=null ? m.getName() : na);
|
||||
String vers = (m.getVersion()!=null ? m.getVersion() : na);
|
||||
String desc = (m.getDescription()!=null ? m.getDescription() : na);
|
||||
%>
|
||||
<entry>
|
||||
<name>
|
||||
<% XML.escapeCharData(key, out); %>
|
||||
</name>
|
||||
<class>
|
||||
<% XML.escapeCharData(name, out); %>
|
||||
</class>
|
||||
<version>
|
||||
<% XML.escapeCharData(vers, out); %>
|
||||
</version>
|
||||
<description>
|
||||
<% XML.escapeCharData(desc, out); %>
|
||||
</description>
|
||||
<stats>
|
||||
<%
|
||||
for (int i = 0; i < nl.size() ; i++) {
|
||||
%>
|
||||
<stat name="<% XML.escapeAttributeValue(nl.getName(i), out); %>" >
|
||||
<% XML.escapeCharData(nl.getVal(i).toString(), out); %>
|
||||
</stat>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</stats>
|
||||
</entry>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</<%= cat.toString() %>>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</solr-info>
|
||||
</solr>
|
220
webapp/src/main/webapp/admin/stats.xsl
Normal file
220
webapp/src/main/webapp/admin/stats.xsl
Normal file
@@ -0,0 +1,220 @@
|
||||
<?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: stats.xsl 728842 2008-12-23 01:45:23Z koji $ -->
|
||||
<!-- $URL: https://svn.apache.org/repos/asf/lucene/solr/tags/release-1.4.1/src/webapp/web/admin/stats.xsl $ -->
|
||||
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version="1.0">
|
||||
|
||||
|
||||
<xsl:output
|
||||
method="html"
|
||||
encoding="utf-8"
|
||||
media-type="text/html; charset=UTF-8"
|
||||
indent="yes"
|
||||
doctype-public="-//W3C//DTD HTML 4.01//EN"
|
||||
doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
|
||||
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:variable name="title">
|
||||
<!-- no whitespace before the colon -->
|
||||
Solr Statistics<xsl:if test="solr/core">:
|
||||
<xsl:value-of select="solr/core"/>
|
||||
</xsl:if>
|
||||
(<xsl:value-of select="solr/schema" />)
|
||||
</xsl:variable>
|
||||
<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><xsl:value-of select="$title"/></title>
|
||||
</head>
|
||||
<body>
|
||||
<a href=".">
|
||||
<img border="0" align="right" height="78" width="142" src="solr_small.png" alt="SOLR">
|
||||
</img>
|
||||
</a>
|
||||
<h1><xsl:value-of select="$title"/></h1>
|
||||
<xsl:value-of select="solr/host" />
|
||||
<br clear="all" />
|
||||
<xsl:apply-templates/>
|
||||
<br /><br />
|
||||
<a href=".">Return to Admin Page</a>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<H3>Category</H3>
|
||||
</td>
|
||||
<td>
|
||||
[<a href="#core">Core</a>]
|
||||
[<a href="#cache">Cache</a>]
|
||||
[<a href="#query">Query</a>]
|
||||
[<a href="#update">Update</a>]
|
||||
[<a href="#highlight">Highlighting</a>]
|
||||
[<a href="#other">Other</a>]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
Current Time: <xsl:value-of select="now" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
Server Start Time: <xsl:value-of select="start" />
|
||||
</td>
|
||||
</tr>
|
||||
<xsl:apply-templates select="*" mode="header" />
|
||||
</table>
|
||||
<xsl:apply-templates select="solr-info" mode="main" />
|
||||
</xsl:template>
|
||||
|
||||
<!-- catch all in case new header info gets added to XML -->
|
||||
<xsl:template match="solr/*" mode="header" priority="-10">
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="local-name()" />: <xsl:value-of select="text()" />
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
<!-- things we've already explicitly taken care of -->
|
||||
<xsl:template match="solr/schema" mode="header" />
|
||||
<xsl:template match="solr/core" mode="header" />
|
||||
<xsl:template match="solr/host" mode="header" />
|
||||
<xsl:template match="solr/now" mode="header" />
|
||||
<xsl:template match="solr/start" mode="header" />
|
||||
<xsl:template match="solr/solr-info" mode="header" />
|
||||
|
||||
<xsl:template match="solr/solr-info" mode="main">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/*">
|
||||
<br />
|
||||
<xsl:apply-templates select="." mode="sub-header" />
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">
|
||||
 
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<xsl:apply-templates/>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/CORE" mode="sub-header">
|
||||
<a name="core"><h2>Core</h2></a>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/CACHE" mode="sub-header">
|
||||
<a name="cache"><h2>Cache</h2></a>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/QUERYHANDLER" mode="sub-header">
|
||||
<a name="query"><h2>Query Handlers</h2></a>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/UPDATEHANDLER" mode="sub-header">
|
||||
<a name="update"><h2>Update Handlers</h2></a>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/HIGHLIGHTING" mode="sub-header">
|
||||
<a name="highlight"><h2>Highlighting</h2></a>
|
||||
</xsl:template>
|
||||
|
||||
<!-- catch all for new types of plugins -->
|
||||
<xsl:template match="solr/solr-info/*" mode="sub-header" priority="-10">
|
||||
<h2><xsl:value-of select="local-name()"/></h2>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/OTHER" mode="sub-header">
|
||||
<a name="other"><h2>Other</h2></a>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="solr/solr-info/*/entry">
|
||||
<tr>
|
||||
<td align="right">
|
||||
<strong>name: </strong>
|
||||
</td>
|
||||
<td>
|
||||
<tt><xsl:value-of select="name"/> </tt>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<strong>class: </strong>
|
||||
</td>
|
||||
<td>
|
||||
<tt><xsl:value-of select="class"/> </tt>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<strong>version: </strong>
|
||||
</td>
|
||||
<td>
|
||||
<tt><xsl:value-of select="version"/> </tt>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<strong>description: </strong>
|
||||
</td>
|
||||
<td>
|
||||
<tt><xsl:value-of select="description"/> </tt>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<strong>stats: </strong>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:for-each select="stats/stat[@name]">
|
||||
<xsl:value-of select="@name"/>
|
||||
<xsl:text> : </xsl:text>
|
||||
<xsl:variable name="name" select="@name" />
|
||||
<xsl:value-of select="." /><br />
|
||||
</xsl:for-each>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
141
webapp/src/main/webapp/admin/tabular.xsl
Normal file
141
webapp/src/main/webapp/admin/tabular.xsl
Normal file
@@ -0,0 +1,141 @@
|
||||
<?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: tabular.xsl 728842 2008-12-23 01:45:23Z koji $ -->
|
||||
<!-- $URL: https://svn.apache.org/repos/asf/lucene/solr/tags/release-1.4.1/src/webapp/web/admin/tabular.xsl $ -->
|
||||
|
||||
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version="1.0">
|
||||
|
||||
|
||||
<xsl:output
|
||||
method="html"
|
||||
encoding="utf-8"
|
||||
media-type="text/html; charset=UTF-8"
|
||||
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 Search Results</title>
|
||||
</head>
|
||||
<body>
|
||||
<a href=".">
|
||||
<img border="0" align="right" height="78" width="142" src="solr_small.png" alt="SOLR">
|
||||
</img>
|
||||
</a>
|
||||
<h1>SOLR Search Results</h1>
|
||||
<br clear="all" />
|
||||
<xsl:apply-templates/>
|
||||
<br /><br />
|
||||
<a href=".">Return to Admin Page</a>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="responseHeader">
|
||||
<table name="responseHeader">
|
||||
<xsl:apply-templates/>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="status">
|
||||
<tr>
|
||||
<td name="responseHeader"><strong>Status: </strong></td>
|
||||
<td><xsl:value-of select="."></xsl:value-of></td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="numFields">
|
||||
<tr>
|
||||
<td name="responseHeader"><strong>Number of Fields: </strong></td>
|
||||
<td><xsl:value-of select="."></xsl:value-of></td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="numRecords">
|
||||
<tr>
|
||||
<td name="responseHeader"><strong>Records Returned: </strong></td>
|
||||
<td><xsl:value-of select="."></xsl:value-of></td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="numFound">
|
||||
<tr>
|
||||
<td name="responseHeader"><strong>Records Found: </strong></td>
|
||||
<td><xsl:value-of select="."></xsl:value-of></td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="QTime">
|
||||
<tr>
|
||||
<td name="responseHeader"><strong>Query time: </strong></td>
|
||||
<td><xsl:value-of select="."></xsl:value-of>(ms)</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
<!-- YCS.. match everything. How to match only what is not
|
||||
matched above???
|
||||
-->
|
||||
<xsl:template match="responseHeader/*">
|
||||
<tr>
|
||||
<td name="responseHeader"><strong><xsl:value-of select="name(.)"></xsl:value-of>: </strong></td>
|
||||
<td><xsl:value-of select="."></xsl:value-of></td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="responseBody">
|
||||
<br></br><br></br>
|
||||
<table border="2">
|
||||
|
||||
<!-- table headers -->
|
||||
<tr>
|
||||
<xsl:for-each select="record[1]/field">
|
||||
<th><xsl:value-of select="name"></xsl:value-of></th>
|
||||
</xsl:for-each>
|
||||
</tr>
|
||||
|
||||
<!-- table rows -->
|
||||
<xsl:for-each select="record">
|
||||
<tr>
|
||||
<xsl:for-each select="field">
|
||||
<td><xsl:value-of select="value"></xsl:value-of> </td>
|
||||
</xsl:for-each>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
110
webapp/src/main/webapp/admin/threaddump.jsp
Normal file
110
webapp/src/main/webapp/admin/threaddump.jsp
Normal file
@@ -0,0 +1,110 @@
|
||||
<%@ page contentType="text/xml; charset=utf-8" pageEncoding="UTF-8" language="java" %>
|
||||
<%--
|
||||
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.
|
||||
--%>
|
||||
<%@ 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.common.util.XML"%>
|
||||
<%@include file="_info.jsp" %>
|
||||
|
||||
|
||||
<?xml-stylesheet type="text/xsl" href="threaddump.xsl"?>
|
||||
<%!
|
||||
static ThreadMXBean tmbean = ManagementFactory.getThreadMXBean();
|
||||
%>
|
||||
<solr>
|
||||
<core><%= collectionName %></core>
|
||||
<system>
|
||||
<jvm>
|
||||
<version><%=System.getProperty("java.vm.version")%></version>
|
||||
<name><%=System.getProperty("java.vm.name")%></name>
|
||||
</jvm>
|
||||
<threadCount>
|
||||
<current><%=tmbean.getThreadCount()%></current>
|
||||
<peak><%=tmbean.getPeakThreadCount()%></peak>
|
||||
<daemon><%=tmbean.getDaemonThreadCount()%></daemon>
|
||||
</threadCount>
|
||||
<%
|
||||
long[] tids;
|
||||
ThreadInfo[] tinfos;
|
||||
tids = tmbean.findMonitorDeadlockedThreads();
|
||||
if (tids != null) {
|
||||
out.println(" <deadlocks>");
|
||||
tinfos = tmbean.getThreadInfo(tids, Integer.MAX_VALUE);
|
||||
for (ThreadInfo ti : tinfos) {
|
||||
printThreadInfo(ti, out);
|
||||
}
|
||||
out.println(" </deadlocks>");
|
||||
}
|
||||
%>
|
||||
<%
|
||||
tids = tmbean.getAllThreadIds();
|
||||
tinfos = tmbean.getThreadInfo(tids, Integer.MAX_VALUE);
|
||||
out.println(" <threadDump>");
|
||||
for (ThreadInfo ti : tinfos) {
|
||||
printThreadInfo(ti, out);
|
||||
}
|
||||
out.println(" </threadDump>");
|
||||
%>
|
||||
</system>
|
||||
</solr>
|
||||
|
||||
<%!
|
||||
static void printThreadInfo(ThreadInfo ti, JspWriter out) throws IOException {
|
||||
long tid = ti.getThreadId();
|
||||
out.println(" <thread>");
|
||||
out.println(" <id>" + tid + "</id>");
|
||||
out.print(" <name>");
|
||||
XML.escapeCharData(ti.getThreadName(), out);
|
||||
out.println("</name>");
|
||||
out.println(" <state>" + ti.getThreadState() + "</state>");
|
||||
if (ti.getLockName() != null) {
|
||||
out.println(" <lock>" + ti.getLockName() + "</lock>");
|
||||
}
|
||||
if (ti.isSuspended()) {
|
||||
out.println(" <suspended/>");
|
||||
}
|
||||
if (ti.isInNative()) {
|
||||
out.println(" <inNative/>");
|
||||
}
|
||||
if (tmbean.isThreadCpuTimeSupported()) {
|
||||
out.println(" <cpuTime>" + formatNanos(tmbean.getThreadCpuTime(tid)) + "</cpuTime>");
|
||||
out.println(" <userTime>" + formatNanos(tmbean.getThreadUserTime(tid)) + "</userTime>");
|
||||
}
|
||||
|
||||
if (ti.getLockOwnerName() != null) {
|
||||
out.println(" <owner>");
|
||||
out.println(" <name>" + ti.getLockOwnerName() + "</name>");
|
||||
out.println(" <id>" + ti.getLockOwnerId() + "</id>");
|
||||
out.println(" </owner>");
|
||||
}
|
||||
out.println(" <stackTrace>");
|
||||
for (StackTraceElement ste : ti.getStackTrace()) {
|
||||
out.print(" <line>");
|
||||
XML.escapeCharData("at " + ste.toString(), out);
|
||||
out.println(" </line>");
|
||||
}
|
||||
out.println(" </stackTrace>");
|
||||
out.println(" </thread>");
|
||||
}
|
||||
|
||||
static String formatNanos(long ns) {
|
||||
return String.format("%.4fms", ns / (double) 1000000);
|
||||
}
|
||||
%>
|
103
webapp/src/main/webapp/admin/threaddump.xsl
Normal file
103
webapp/src/main/webapp/admin/threaddump.xsl
Normal file
@@ -0,0 +1,103 @@
|
||||
<?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"
|
||||
encoding="utf-8"
|
||||
media-type="text/html; charset=UTF-8"
|
||||
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="78" width="142" src="solr_small.png" 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>
|
BIN
webapp/src/main/webapp/favicon.ico
Executable file
BIN
webapp/src/main/webapp/favicon.ico
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
42
webapp/src/main/webapp/index.jsp
Normal file
42
webapp/src/main/webapp/index.jsp
Normal file
@@ -0,0 +1,42 @@
|
||||
<%--
|
||||
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.
|
||||
--%>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="solr-admin.css">
|
||||
<link rel="icon" href="favicon.ico" type="image/ico"></link>
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/ico"></link>
|
||||
<title>Welcome to Solr</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Welcome to Solr!</h1>
|
||||
<a href="."><img border="0" align="right" height="78" width="142" src="admin/solr_small.png" alt="Solr"/></a>
|
||||
|
||||
<%
|
||||
org.apache.solr.core.CoreContainer cores = (org.apache.solr.core.CoreContainer)request.getAttribute("org.apache.solr.CoreContainer");
|
||||
if( cores != null
|
||||
&& cores.getCores().size() > 0 // HACK! check that we have valid names...
|
||||
&& cores.getCores().iterator().next().getName().length() != 0 ) {
|
||||
for( org.apache.solr.core.SolrCore core : cores.getCores() ) {%>
|
||||
<a href="<%= core.getName() %>/admin/">Admin <%= core.getName() %></a><br/>
|
||||
<% }} else { %>
|
||||
<a href="admin/">Solr Admin</a>
|
||||
<% } %>
|
||||
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user