You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/09/28 15:57:34 UTC
svn commit: r580358 - in /lenya/trunk/src/modules: lucene/sitemap.xmap
lucene/xslt/search2html.xsl resource/config/cocoon-xconf/module.xconf
resource/sitemap.xmap
Author: andreas
Date: Fri Sep 28 06:57:33 2007
New Revision: 580358
URL: http://svn.apache.org/viewvc?rev=580358&view=rev
Log:
Index resource meta data (fixes bug 43456), search in meta data fiels
Modified:
lenya/trunk/src/modules/lucene/sitemap.xmap
lenya/trunk/src/modules/lucene/xslt/search2html.xsl
lenya/trunk/src/modules/resource/config/cocoon-xconf/module.xconf
lenya/trunk/src/modules/resource/sitemap.xmap
Modified: lenya/trunk/src/modules/lucene/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lucene/sitemap.xmap?rev=580358&r1=580357&r2=580358&view=diff
==============================================================================
--- lenya/trunk/src/modules/lucene/sitemap.xmap (original)
+++ lenya/trunk/src/modules/lucene/sitemap.xmap Fri Sep 28 06:57:33 2007
@@ -91,10 +91,18 @@
<map:serialize type="xml"/>
</map:match>
- <map:match pattern="search/*/*.xml">
+ <!-- {1:pub}/{2:area}/{3:queryString} -->
+ <map:match pattern="search-generator/*/*/*">
<map:generate type="search">
<map:parameter name="index" value="{index-path:{1}-{2}}"/>
+ <map:parameter name="query" value="title:{3} OR description:{3} OR subject:{3} OR body:{3}"/>
</map:generate>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ <!-- {1:pub}/{2:area} -->
+ <map:match pattern="search/*/*.xml">
+ <map:generate src="cocoon:/search-generator/{1}/{2}/{request-param:queryString}"/>
<map:transform type="uuid2url">
<map:parameter name="pubId" value="{1}"/>
<map:parameter name="area" value="{2}"/>
@@ -104,18 +112,16 @@
<map:match pattern="search.xml">
<map:generate src="cocoon:/search/{page-envelope:publication-id}/{page-envelope:area}.xml"/>
-
<map:transform src="fallback://lenya/modules/lucene/xslt/search2html.xsl">
<map:parameter name="url" value="{page-envelope:document-url}"/>
<map:parameter name="area" value="{page-envelope:area}"/>
<map:parameter name="pub" value="{page-envelope:publication-id}"/>
<map:parameter name="root" value="/{page-envelope:publication-id}/{page-envelope:area}"/>
<map:parameter name="use-request-parameters" value="true"/>
+ <map:parameter name="queryString" value="{request-param:queryString}"/>
</map:transform>
-
<map:transform type="cinclude"/>
<map:transform type="uuid2url"/>
-
<map:serialize type="xml"/>
</map:match>
Modified: lenya/trunk/src/modules/lucene/xslt/search2html.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/lucene/xslt/search2html.xsl?rev=580358&r1=580357&r2=580358&view=diff
==============================================================================
--- lenya/trunk/src/modules/lucene/xslt/search2html.xsl (original)
+++ lenya/trunk/src/modules/lucene/xslt/search2html.xsl Fri Sep 28 06:57:33 2007
@@ -26,12 +26,21 @@
exclude-result-prefixes="cinclude search xhtml"
>
-<xsl:param name="url"/>
-<xsl:param name="area"/>
-<xsl:param name="pub"/>
-<xsl:param name="root"/>
-<xsl:param name="lenya.usecase"/>
-
+ <xsl:param name="url"/>
+ <xsl:param name="area"/>
+ <xsl:param name="pub"/>
+ <xsl:param name="root"/>
+ <xsl:param name="lenya.usecase"/>
+ <xsl:param name="queryString"/>
+
+ <xsl:variable name="usecaseParam">
+ <xsl:if test="$lenya.usecase != ''">
+ <xsl:text>lenya.usecase=</xsl:text>
+ <xsl:value-of select="$lenya.usecase"/>
+ <xsl:text>&</xsl:text>
+ </xsl:if>
+ </xsl:variable>
+
<xsl:template match="search:results">
<div id="body">
<xsl:apply-templates/>
@@ -49,7 +58,7 @@
-->
<h1><i18n:text>Search</i18n:text></h1>
<form action="" method="get" style="margin-bottom: 20px">
- <input name="queryString" type="text" style="width: 400px" value="{/search:results/@query-string}"
+ <input name="queryString" type="text" style="width: 400px" value="{$queryString}"
/> <input type="submit" name="submit" value="Search" i18n:attr="value"/>
</form>
@@ -64,6 +73,7 @@
</ul>
<p>
+ <i18n:text>Pages</i18n:text><xsl:text>: </xsl:text>
<xsl:if test="count(/search:results/search:navigation/search:navigation-page) > 1">
<xsl:for-each select="/search:results/search:navigation/search:navigation-page">
@@ -89,6 +99,7 @@
</xsl:template>
<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/@query-string"/></xsl:with-param>
@@ -99,6 +110,7 @@
<xsl:with-param name="next-index"><xsl:value-of select="@next-index"/></xsl:with-param>
</xsl:call-template>
</p>
+ -->
</xsl:template>
<xsl:template match="search:hit">
@@ -129,7 +141,6 @@
</xsl:template>
<xsl:template name="navigation-paging-form">
- <xsl:param name="query-string"/>
<xsl:param name="page-length"/>
<xsl:param name="has-previous"/>
<xsl:param name="has-next"/>
@@ -138,28 +149,31 @@
<xsl:if test="$has-previous = 'true'">
<form action="" id="form-previous">
- <input type="hidden" name="lenya.usecase" value="{$lenya.usecase}"/>
+ <xsl:if test="$lenya.usecase != ''">
+ <input type="hidden" name="lenya.usecase" value="{$lenya.usecase}"/>
+ </xsl:if>
<input type="hidden" name="startIndex" value="{$previous-index}"/>
- <input type="hidden" name="queryString" value="{$query-string}"/>
+ <input type="hidden" name="queryString" value="{$queryString}"/>
<input type="hidden" name="pageLength" value="{$page-length}"/>
- <input type="submit" name="previous" value="previous"/>
+ <input type="submit" name="previous" value="Previous" i18n:attr="value"/>
</form>
</xsl:if>
<xsl:if test="$has-next = 'true'">
<form action="" id="form-next">
- <input type="hidden" name="lenya.usecase" value="{$lenya.usecase}"/>
+ <xsl:if test="lenya.usecase != ''">
+ <input type="hidden" name="lenya.usecase" value="{$lenya.usecase}"/>
+ </xsl:if>
<input type="hidden" name="startIndex" value="{$next-index}"/>
- <input type="hidden" name="queryString" value="{$query-string}"/>
+ <input type="hidden" name="queryString" value="{$queryString}"/>
<input type="hidden" name="pageLength" value="{$page-length}"/>
- <input type="submit" name="next" value="next"/>
+ <input type="submit" name="next" value="Next" i18n:attr="value"/>
</form>
</xsl:if>
</xsl:template>
<xsl:template name="navigation-paging-link">
- <xsl:param name="query-string"/>
<xsl:param name="page-length"/>
<xsl:param name="has-previous"/>
<xsl:param name="has-next"/>
@@ -168,16 +182,15 @@
<xsl:if test="$has-previous = 'true'">
<xsl:call-template name="navigation-link">
- <xsl:with-param name="query-string"><xsl:value-of select="$query-string"/></xsl:with-param>
<xsl:with-param name="page-length"><xsl:value-of select="$page-length"/></xsl:with-param>
<xsl:with-param name="start-index"><xsl:value-of select="$previous-index"/></xsl:with-param>
- <xsl:with-param name="link-text">Previous Page Of Hits</xsl:with-param>
+ <xsl:with-param name="link-text"><</xsl:with-param>
</xsl:call-template>
</xsl:if>
-  
+ <xsl:text> </xsl:text>
<xsl:if test="$has-next = 'true'">
- <a href="index.html?lenya.usecase={$lenya.usecase}&startIndex={$next-index}&queryString={$query-string}&pageLength={$page-length}">
- Next Page Of Hits
+ <a href="?{$usecaseParam}startIndex={$next-index}&queryString={$queryString}&pageLength={$page-length}">
+ <xsl:text>></xsl:text>
</a>
</xsl:if>
</xsl:template>
@@ -188,10 +201,10 @@
<xsl:param name="start-index"/>
<xsl:param name="link-text"/>
- <a href="index.html?lenya.usecase={$lenya.usecase}&startIndex={$start-index}&queryString={$query-string}&pageLength={$page-length}">
+ <a href="?{$usecaseParam}startIndex={$start-index}&queryString={$queryString}&pageLength={$page-length}">
<xsl:value-of select="$link-text"/>
</a>
-  
+ <xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="@*|node()" priority="-2"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
Modified: lenya/trunk/src/modules/resource/config/cocoon-xconf/module.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/resource/config/cocoon-xconf/module.xconf?rev=580358&r1=580357&r2=580358&view=diff
==============================================================================
--- lenya/trunk/src/modules/resource/config/cocoon-xconf/module.xconf (original)
+++ lenya/trunk/src/modules/resource/config/cocoon-xconf/module.xconf Fri Sep 28 06:57:33 2007
@@ -34,6 +34,7 @@
<format name="xhtml" uri="cocoon://modules/resource/xhtml.xml"/>
<format name="downloadLink" uri="cocoon://modules/resource/downloadLink.xml"/>
<format name="icon" uri="cocoon://modules/resource/icon"/>
+ <format name="luceneIndex" uri="cocoon://modules/resource/lucene-index"/>
</component-instance>
</xconf>
Modified: lenya/trunk/src/modules/resource/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/resource/sitemap.xmap?rev=580358&r1=580357&r2=580358&view=diff
==============================================================================
--- lenya/trunk/src/modules/resource/sitemap.xmap (original)
+++ lenya/trunk/src/modules/resource/sitemap.xmap Fri Sep 28 06:57:33 2007
@@ -31,12 +31,27 @@
</map:components>
<map:pipelines>
- <!-- Generates the lenya metadata to be aggregated for each page -->
+
<map:pipeline>
+
+ <!-- Generates the lenya metadata to be aggregated for each page -->
+ <!-- {1:pubId}/{2:area}/{3:uuid}/{4:language}/{5:revision} -->
<map:match pattern="lenyametadata.xml/*/*/*/*/*">
<map:generate type="lenyaMetaData" src="lenya-document:{3},pub={1},area={2},lang={4},rev={5}"/>
<map:serialize type="xml"/>
</map:match>
+
+ <!-- {pub-id}/{area}/{uuid}/{language} -->
+ <map:match pattern="lucene-index/*/*/*/*">
+ <map:aggregate element="cmsbody">
+ <map:part src="cocoon:/lenyametadata.xml/{1}/{2}/{3}/{4}/-1"/>
+ </map:aggregate>
+ <map:transform src="fallback://lenya/modules/xhtml/xslt/xhtml2index.xsl">
+ <map:parameter name="url" value="{request:requestURI}"/>
+ </map:transform>
+ <map:serialize type="xml"/>
+ </map:match>
+
</map:pipeline>
<map:pipeline>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org