blob: 8fde4d29865e511f0cb3e18327df6727e3d35f4a [file] [log] [blame]
<?xml version="1.0"?>
<!--
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.
-->
<!-- ===============================================
Pipelines relevant to Lucene index creation and searching.
Creates lucene:documents from Forrest documents, to be used for indexing
by the LuceneIndexTransformer.
Aggregates all lucene:documents from a site into a single lucene:index
document.
Uses the LuceneIndexTransformer to create a Lucene index from this
lucene:index document.
Allows searching the Lucene index using the Cocoon SearchGenerator.
Generates : Lucene lucene:index documents, search results
Example URLs: http://localhost/lucene-update.html (Index creation)
http://localhost/**.html (use the search box after setting
<search provider="lucene"/> in skinconf.xml)
Uses : content/xdocs/**.xml, context/xdocs/**.ehtml,
resources/stylesheets/*-to-*lucene*.xsl
$Revision$
==================================================== -->
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
<!-- Lucene search generator: Creates a hit list from a query and
an existing index. -->
<map:generators default="file">
<map:generator name="search"
logger="sitemap.generator.searchgenerator"
src="org.apache.cocoon.generation.SearchGenerator" />
</map:generators>
<!-- Lucene index transformer: Creates a new Lucene index. -->
<map:transformers default="xslt">
<map:transformer name="index"
logger="sitemap.transformer.luceneindextransformer"
src="org.apache.cocoon.transformation.LuceneIndexTransformer"/>
</map:transformers>
<map:readers default="resource"/>
<map:serializers default="html"/>
<map:matchers default="wildcard"/>
</map:components>
<!-- =========================== Pipelines ================================= -->
<map:pipelines>
<map:pipeline internal-only="false">
<!-- ===== INDEX CREATION ===== -->
<!-- Creates or updates the Lucene index -->
<map:match pattern="lucene-update.xml">
<map:generate src="cocoon:/index-creation.lucene"/>
<map:transform type="index"/>
<map:transform src="{lm:transform.lucene-update.xdoc}"/>
<map:serialize type="xml"/>
</map:match>
<!-- ===== INDEX QUERYING ===== -->
<!-- Searches the Lucene index using the search expression given
in the request param named "queryString" -->
<map:match pattern="lucene-search.xml">
<map:generate type="search">
<!-- Important: This value must match that of the
"directory" parameter passed to book-to-cinclude-lucene.xsl (see
below) -->
<map:parameter name="index" value="lucene-index"/>
<map:parameter name="query-string" value="queryString"/>
</map:generate>
<map:transform src="{lm:transform.lucene-search.xdoc}"/>
<map:serialize type="xml"/>
</map:match>
<!-- ===== DOCUMENTS FOR LUCENE INDEX TRANSFORMER ===== -->
<!-- Generates a document suitable for processing by the
LuceneIndexTransformer, using sources across the whole site -->
<map:match pattern="index-creation.lucene">
<map:generate src="cocoon://abs-linkmap"/>
<map:transform src="{lm:transform.site.book}" />
<map:transform src="{lm:transform.book.cinclude-lucene}">
<map:parameter name="analyzer" value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
<map:parameter name="merge-factor" value="20"/>
<map:parameter name="update-index" value="true"/>
<!-- Important: This value must match that of the
"index" parameter passed to the search generator (see
above) -->
<map:parameter name="directory" value="lucene-index"/>
</map:transform>
<map:transform type="cinclude"/>
<map:serialize type="xml"/>
</map:match>
<!-- Creates a lucene:document from a Forrest document body -->
<map:match pattern="**body-*.lucene">
<map:select type="exists">
<map:when test="{properties:content.xdocs}{1}{2}.ehtml">
<map:generate src="{properties:content.xdocs}{1}{2}.ehtml" />
<map:transform src="{lm:transform.html.htmlbody}" />
</map:when>
<map:when test="cocoon://{1}{2}.xml">
<map:generate src="cocoon://{1}{2}.xml"/>
</map:when>
</map:select>
<map:transform src="{lm:transform.xdoc.lucene}">
<map:parameter name="document-url" value="{1}{2}.xml"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
<!-- Creates a lucene:document from a Forrest document (same as
above, as search-relevant information is only contained in the
body) -->
<map:match pattern="*.lucene">
<map:generate src="cocoon:/body-{0}"/>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="**/*.lucene">
<map:generate src="cocoon:/{1}/body-{2}.lucene"/>
<map:serialize type="xml"/>
</map:match>
<!-- ===== TODO: ERROR HANDLING ===== -->
<!-- Must do something about malformed (unparseable) queries or
a non-existant index. -->
</map:pipeline>
</map:pipelines>
</map:sitemap>