You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by hu...@apache.org on 2003/12/12 09:15:55 UTC
cvs commit: cocoon-2.1/src/blocks/lucene/samples/stylesheets search2html.xsl
huber 2003/12/12 00:15:55
Modified: src/blocks/lucene/samples create-index.xsp sitemap.xmap
statistic-index.xsp
src/blocks/lucene/samples/stylesheets search2html.xsl
Log:
fix usage of main.css
fix search2html don't use ns in attributes
add Welcome links
Revision Changes Path
1.2 +5 -0 cocoon-2.1/src/blocks/lucene/samples/create-index.xsp
Index: create-index.xsp
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/lucene/samples/create-index.xsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- create-index.xsp 21 Mar 2003 07:54:18 -0000 1.1
+++ create-index.xsp 12 Dec 2003 08:15:55 -0000 1.2
@@ -79,6 +79,11 @@
<content>
<h1>Create a Lucene search index</h1>
<para>
+ <font size="-1">
+ <a href="welcome">Welcome</a>
+ </font>
+ </para>
+ <para>
This process might take some time (follow the tail of your logfiles
to see the indexer in progress).
<ul>
1.3 +3 -1 cocoon-2.1/src/blocks/lucene/samples/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/lucene/samples/sitemap.xmap,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sitemap.xmap 22 Oct 2003 11:42:05 -0000 1.2
+++ sitemap.xmap 12 Dec 2003 08:15:55 -0000 1.3
@@ -78,7 +78,9 @@
"[...] All <map:parameter> declarations will be made
available in the XSLT stylesheet as xsl:variables. [...]"
-->
- <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl"/>
+ <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
+ <map:parameter name="contextPath" value="{request:contextPath}"/>
+ </map:transform>
<map:serialize/>
</map:match>
1.2 +26 -3 cocoon-2.1/src/blocks/lucene/samples/statistic-index.xsp
Index: statistic-index.xsp
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/lucene/samples/statistic-index.xsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- statistic-index.xsp 21 Mar 2003 07:54:19 -0000 1.1
+++ statistic-index.xsp 12 Dec 2003 08:15:55 -0000 1.2
@@ -33,21 +33,34 @@
throw new ProcessingException( "Exception in init()!", e );
}
}
+
+ void closeReader( IndexReader reader ) {
+ if (reader != null) {
+ try {
+ reader.close();
+ } catch (IOException ioe) {
+ }
+ }
+ }
int numDocs() throws ProcessingException {
+ IndexReader reader = null;
try {
- IndexReader reader = IndexReader.open( directory );
+ reader = IndexReader.open( directory );
int num_docs;
num_docs = reader.numDocs();
return num_docs;
} catch (Exception e) {
throw new ProcessingException( "Exception in numDocs()!", e );
+ } finally {
+ closeReader(reader);
}
}
Map allDocuments() throws ProcessingException {
+ IndexReader reader = null;
try {
- IndexReader reader = IndexReader.open( directory );
+ reader = IndexReader.open( directory );
HashMap fieldsStatistic = new HashMap();
@@ -76,12 +89,15 @@
//map.keySet();
} catch (Exception e) {
throw new ProcessingException( "Exception allDocuments()!", e );
+ } finally {
+ closeReader(reader);
}
}
Map allTerms() throws ProcessingException {
+ IndexReader reader = null;
try {
- IndexReader reader = IndexReader.open( directory );
+ reader = IndexReader.open( directory );
TermEnum te = reader.terms();
HashMap all_fields = new HashMap();
@@ -103,6 +119,8 @@
return all_fields;
} catch (Exception e) {
throw new ProcessingException( "Exception allDocuments()!", e );
+ } finally {
+ closeReader(reader);
}
}
Map sort( Map map ) {
@@ -117,6 +135,11 @@
</xsp:logic>
<title>Index Statistics</title>
<content>
+ <para>
+ <font size="-1">
+ <a href="welcome">Welcome</a>
+ </font>
+ </para>
<para>
Statistics:
</para>
1.2 +22 -22 cocoon-2.1/src/blocks/lucene/samples/stylesheets/search2html.xsl
Index: search2html.xsl
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/lucene/samples/stylesheets/search2html.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- search2html.xsl 21 Mar 2003 07:54:19 -0000 1.1
+++ search2html.xsl 12 Dec 2003 08:15:55 -0000 1.2
@@ -25,7 +25,7 @@
</p>
<form action="findIt">
- <input type="text" name="queryString" size="60" value="{@search:query-string}"/>
+ <input type="text" name="queryString" size="60" value="{@query-string}"/>
 
<input type="submit" name="Search" value="Search"/>
</form>
@@ -72,16 +72,16 @@
<xsl:template match="search:hits">
<p>
- Total Hits <xsl:value-of select="@search:total-count"/>
- Pages <xsl:value-of select="@search:count-of-pages"/>
+ Total Hits <xsl:value-of select="@total-count"/>
+ Pages <xsl:value-of select="@count-of-pages"/>
</p>
<p>
Page:
<xsl:for-each select="/search:results/search:navigation/search:navigation-page">
<xsl:call-template name="navigation-link">
- <xsl:with-param name="query-string" select="/search:results/@search:query-string"/>
- <xsl:with-param name="page-length" select="/search:results/@search:page-length"/>
- <xsl:with-param name="start-index" select="@search:start-index"/>
+ <xsl:with-param name="query-string" select="/search:results/@query-string"/>
+ <xsl:with-param name="page-length" select="/search:results/@page-length"/>
+ <xsl:with-param name="start-index" select="@start-index"/>
<xsl:with-param name="link-text" select="position()"/>
</xsl:call-template>
</xsl:for-each>
@@ -89,12 +89,12 @@
<p>
<xsl:call-template name="navigation-paging-link">
- <xsl:with-param name="query-string" select="/search:results/@search:query-string"/>
- <xsl:with-param name="page-length" select="/search:results/@search:page-length"/>
- <xsl:with-param name="has-previous" select="/search:results/search:navigation/@search:has-previous"/>
- <xsl:with-param name="has-next" select="/search:results/search:navigation/@search:has-next"/>
- <xsl:with-param name="previous-index" select="/search:results/search:navigation/@search:previous-index"/>
- <xsl:with-param name="next-index" select="/search:results/search:navigation/@search:next-index"/>
+ <xsl:with-param name="query-string" select="/search:results/@query-string"/>
+ <xsl:with-param name="page-length" select="/search:results/@page-length"/>
+ <xsl:with-param name="has-previous" select="/search:results/search:navigation/@has-previous"/>
+ <xsl:with-param name="has-next" select="/search:results/search:navigation/@has-next"/>
+ <xsl:with-param name="previous-index" select="/search:results/search:navigation/@previous-index"/>
+ <xsl:with-param name="next-index" select="/search:results/search:navigation/@next-index"/>
</xsl:call-template>
</p>
<hr/>
@@ -110,12 +110,12 @@
<xsl:template match="search:navigation">
<p>
<xsl:call-template name="navigation-paging-form">
- <xsl:with-param name="query-string"><xsl:value-of select="/search:results/@search:query-string"/></xsl:with-param>
- <xsl:with-param name="page-length"><xsl:value-of select="/search:results/@search:page-length"/></xsl:with-param>
- <xsl:with-param name="has-previous"><xsl:value-of select="@search:has-previous"/></xsl:with-param>
- <xsl:with-param name="has-next"><xsl:value-of select="@search:has-next"/></xsl:with-param>
- <xsl:with-param name="previous-index"><xsl:value-of select="@search:previous-index"/></xsl:with-param>
- <xsl:with-param name="next-index"><xsl:value-of select="@search:next-index"/></xsl:with-param>
+ <xsl:with-param name="query-string"><xsl:value-of select="/search:results/@query-string"/></xsl:with-param>
+ <xsl:with-param name="page-length"><xsl:value-of select="/search:results/@page-length"/></xsl:with-param>
+ <xsl:with-param name="has-previous"><xsl:value-of select="@has-previous"/></xsl:with-param>
+ <xsl:with-param name="has-next"><xsl:value-of select="@has-next"/></xsl:with-param>
+ <xsl:with-param name="previous-index"><xsl:value-of select="@previous-index"/></xsl:with-param>
+ <xsl:with-param name="next-index"><xsl:value-of select="@next-index"/></xsl:with-param>
</xsl:call-template>
</p>
</xsl:template>
@@ -123,14 +123,14 @@
<xsl:template match="search:hit">
<tr>
<td>
- <xsl:value-of select="format-number( @search:score, '### %' )"/>
+ <xsl:value-of select="format-number( @score, '### %' )"/>
</td>
<td>
- <xsl:value-of select="@search:rank"/>
+ <xsl:value-of select="@rank"/>
</td>
<td>
- <a target="_blank" href="{@search:uri}">
- <xsl:value-of select="@search:uri"/>
+ <a target="_blank" href="{@uri}">
+ <xsl:value-of select="@uri"/>
</a>
</td>
</tr>