lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r672961 - in /lucene/solr/trunk: CHANGES.txt src/webapp/web/admin/stats.jsp src/webapp/web/admin/stats.xsl
Date Tue, 01 Jul 2008 00:24:25 GMT
Author: hossman
Date: Mon Jun 30 17:24:25 2008
New Revision: 672961

URL: http://svn.apache.org/viewvc?rev=672961&view=rev
Log:
SOLR-584: make stats.jsp and stats.xsl more robust to new info as they are added - spurred
by core name not being displayed properly, fix also includes section for highlighting plugins
and some general major refactoring of stats.xsl

Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/src/webapp/web/admin/stats.jsp
    lucene/solr/trunk/src/webapp/web/admin/stats.xsl

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=672961&r1=672960&r2=672961&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Mon Jun 30 17:24:25 2008
@@ -446,6 +446,8 @@
 
 37. SOLR-604: If the spellchecking path is relative, make it relative to the Solr Data Directory.
 (Shalin Shekhar Mangar via gsingers)
 
+38. SOLR-584: Make stats.jsp and stats.xsl more robust.
+    (Yousef Ourabi and hossman)
 
 Other Changes
  1. SOLR-135: Moved common classes to org.apache.solr.common and altered the

Modified: lucene/solr/trunk/src/webapp/web/admin/stats.jsp
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/stats.jsp?rev=672961&r1=672960&r2=672961&view=diff
==============================================================================
--- lucene/solr/trunk/src/webapp/web/admin/stats.jsp (original)
+++ lucene/solr/trunk/src/webapp/web/admin/stats.jsp Mon Jun 30 17:24:25 2008
@@ -25,7 +25,10 @@
 
 
 <solr>
-  <core><%=core.getName()%></core>
+  <%  
+  if (core.getName() != null) { %> 
+	  <core><%=core.getName()%></core> 
+  <% } %>
   <schema><%= collectionName %></schema>
   <host><%= hostname %></host>
   <now><%= new Date().toString() %></now>

Modified: lucene/solr/trunk/src/webapp/web/admin/stats.xsl
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/stats.xsl?rev=672961&r1=672960&r2=672961&view=diff
==============================================================================
--- lucene/solr/trunk/src/webapp/web/admin/stats.xsl (original)
+++ lucene/solr/trunk/src/webapp/web/admin/stats.xsl Mon Jun 30 17:24:25 2008
@@ -33,19 +33,26 @@
 
 
   <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>SOLR Statistics</title>
+        <title><xsl:value-of select="$title"/></title>
       </head>
       <body>
         <a href=".">
 	   <img border="0" align="right" height="61" width="142" src="solr-head.gif" alt="SOLR">
 	   </img>
 	</a>
-        <h1>SOLR Statistics (<xsl:value-of select="solr/schema" />)</h1>
+        <h1><xsl:value-of select="$title"/></h1>
           <xsl:value-of select="solr/host" />
           <br clear="all" />
         <xsl:apply-templates/>
@@ -66,6 +73,7 @@
         [<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>
@@ -83,25 +91,37 @@
         Server Start Time: <xsl:value-of select="start" />
       </td>
     </tr>
+    <xsl:apply-templates select="*" mode="header" />
   </table>
-  <xsl:apply-templates/>
+  <xsl:apply-templates select="solr-info" mode="main" />
   </xsl:template>
 
-  <xsl:template match="solr/schema" />
-
-  <xsl:template match="solr/host" />
-
-  <xsl:template match="solr/now" />
+  <!-- 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>
 
-  <xsl:template match="solr/start" />
+  <!-- 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">
-  <xsl:apply-templates/>
+  <xsl:template match="solr/solr-info" mode="main">
+    <xsl:apply-templates/>
   </xsl:template>
 
-  <xsl:template match="solr/solr-info/CORE">
+  <xsl:template match="solr/solr-info/*">
     <br />
-    <a name="core"><h2>Core</h2></a>
+    <xsl:apply-templates select="." mode="sub-header" />
     <table>
         <tr>
           <td align="right">
@@ -110,287 +130,40 @@
           <td>
           </td>
         </tr>
-    <xsl:apply-templates/>
+        <xsl:apply-templates/>
     </table>
   </xsl:template>
 
-  <xsl:template match="solr/solr-info/CORE/entry">
-        <tr>
-          <td align="right">
-            <strong>name:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="name"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>class:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="class"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>version:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="version"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>description:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="description"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>stats:&#xa0;</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 match="solr/solr-info/CORE" mode="sub-header">
+    <a name="core"><h2>Core</h2></a>
   </xsl:template>
 
-  <xsl:template match="solr/solr-info/CACHE">
-    <br />
+  <xsl:template match="solr/solr-info/CACHE" mode="sub-header">
     <a name="cache"><h2>Cache</h2></a>
-    <table>
-        <tr>
-          <td align="right">
-            &#xa0;
-          </td>
-          <td>
-          </td>
-        </tr>
-    <xsl:apply-templates/>
-    </table>
-  </xsl:template>
-
-  <xsl:template match="solr/solr-info/CACHE/entry">
-        <tr>
-          <td align="right">
-            <strong>name:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="name"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>class:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="class"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>version:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="version"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>description:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="description"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>stats:&#xa0;</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:template match="solr/solr-info/QUERYHANDLER">
-    <br />
+  <xsl:template match="solr/solr-info/QUERYHANDLER" mode="sub-header">
     <a name="query"><h2>Query Handlers</h2></a>
-    <table>
-        <tr>
-          <td align="right">
-            &#xa0;
-          </td>
-          <td>
-          </td>
-        </tr>
-    <xsl:apply-templates/>
-    </table>
   </xsl:template>
 
-  <xsl:template match="solr/solr-info/QUERYHANDLER/entry">
-        <tr>
-          <td align="right">
-            <strong>name:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="name"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>class:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="class"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>version:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="version"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>description:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="description"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>stats:&#xa0;</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 match="solr/solr-info/UPDATEHANDLER" mode="sub-header">
+    <a name="update"><h2>Update Handlers</h2></a>
   </xsl:template>
 
-  <xsl:template match="solr/solr-info/UPDATEHANDLER">
-    <br />
-    <a name="update"><h2>Update Handlers</h2></a>
-    <table>
-        <tr>
-          <td align="right">
-            &#xa0;
-          </td>
-          <td>
-          </td>
-        </tr>
-    <xsl:apply-templates/>
-    </table>
+  <xsl:template match="solr/solr-info/HIGHLIGHTING" mode="sub-header">
+    <a name="highlight"><h2>Highlighting</h2></a>
   </xsl:template>
 
-  <xsl:template match="solr/solr-info/UPDATEHANDLER/entry">
-        <tr>
-          <td align="right">
-            <strong>name:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="name"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>class:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="class"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>version:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="version"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>description:&#xa0;</strong>
-          </td>
-          <td>
-            <tt><xsl:value-of select="description"/>&#xa0;</tt>
-          </td>
-        </tr>
-        <tr>
-          <td align="right">
-            <strong>stats:&#xa0;</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>
+  <!-- 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">
-    <br />
+  <xsl:template match="solr/solr-info/OTHER" mode="sub-header">
     <a name="other"><h2>Other</h2></a>
-    <table>
-        <tr>
-          <td align="right">
-            &#xa0;
-          </td>
-          <td>
-          </td>
-        </tr>
-    <xsl:apply-templates/>
-    </table>
   </xsl:template>
 
-  <xsl:template match="solr/solr-info/OTHER/entry">
+  <xsl:template match="solr/solr-info/*/entry">
         <tr>
           <td align="right">
             <strong>name:&#xa0;</strong>



Mime
View raw message