cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: rev 47285 - in cocoon/branches/BRANCH_2_1_X/src/blocks: cron/conf cron/java/org/apache/cocoon/components/cron lucene/conf lucene/java/org/apache/cocoon/bean lucene/java/org/apache/cocoon/bean/query lucene/java/org/apache/cocoon/components/search lucene/samples lucene/samples/query lucene/samples/query/screens lucene/samples/stylesheets midi/java/org/apache/cocoon/generation repository/java/org/apache/cocoon/components/repository repository/java/org/apache/cocoon/components/source/impl repository/java/org/apache/cocoon/transformation
Date Mon, 27 Sep 2004 12:52:46 GMT
Author: cziegeler
Date: Mon Sep 27 05:52:44 2004
New Revision: 47285

Added:
   cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/ContextAccess.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneCriterion.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneCriterionBean.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneQuery.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneQueryBean.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/query.js
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/advanced-binding.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/advanced-fields.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/advanced-model.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/advanced-template.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/error.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/history.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/index.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/messages.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/results.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/simple-binding.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/simple-fields.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/simple-model.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/simple-template.xml
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/sitemap.xmap
Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron-category.xlog
   cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron-target.xlog
   cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron.xconf
   cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron.xsamples
   cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzDriverDelegate.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobStoreTX.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.samplesxpipe
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xconf
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xmap
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xroles
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xsamples
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/components/search/LuceneCocoonSearcher.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/components/search/SimpleLuceneCocoonSearcherImpl.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/create-index.xsp
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/document-files.xsp
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/search-index.xsp
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/sitemap.xmap
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/statistic-index.xsp
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/all-files2content.xsl
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/content2lucene.xsl
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/lucene-index2html.xsl
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/search-index2html.xsl
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/search2html.xsl
   cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/welcome-index.xsp
   cocoon/branches/BRANCH_2_1_X/src/blocks/midi/java/org/apache/cocoon/generation/XMidiGenerator.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/repository/SourceRepositoryImpl.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/impl/RepositorySourceFactory.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/transformation/SourcePropsWritingTransformer.java
Log:
Sync blocks: cron, lucene, midi and repository

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron-category.xlog
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron-category.xlog	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron-category.xlog	Mon Sep 27 05:52:44 2004
@@ -14,6 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
+<!-- CVS $Id: cron-category.xlog,v 1.4 2004/07/11 19:47:56 antonio Exp $ -->
 <xlog xpath="/logkit/categories"
       unless="category[@name='cron']">
 
@@ -22,4 +23,4 @@
         <log-target id-ref="error"/>
     </category>
     
-</xlog>
\ No newline at end of file
+</xlog>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron-target.xlog
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron-target.xlog	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron-target.xlog	Mon Sep 27 05:52:44 2004
@@ -14,6 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
+<!-- CVS $Id: cron-target.xlog,v 1.3 2004/07/11 19:47:56 antonio Exp $ -->
 <xlog xpath="/logkit/targets" unless="cocoon[@id='cron']">
     <!-- The logger for the cron components -->
     <cocoon id="cron">

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron.xconf
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron.xconf	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron.xconf	Mon Sep 27 05:52:44 2004
@@ -115,22 +115,31 @@
 
         <!--+
             | Sample trigger definitions
-        <trigger name="test-job1"
+            <trigger name="test-job1"
                  target="org.apache.cocoon.components.cron.CronJob/test"
                  concurrent-runs="false">
-            <cron>*/12 * * * * ? *</cron>
-        </trigger>
-        <trigger name="test-job2"
+                <cron>*/12 * * * * ? *</cron>
+            </trigger>
+            <trigger name="test-job2"
                  target="org.apache.cocoon.components.cron.CronJob/test"
                  concurrent-runs="true">
-            <seconds>*/12</seconds>
-            <minutes>*/5</minutes>
-            <hours>8,10,12,14,16,18</hours>
-            <days>?</days>
-            <months>*</months>
-            <weekdays>SUN-FRI</weekdays>
-        </trigger>
-            +-->
+                 <seconds>*/12</seconds>
+                 <minutes>*/5</minutes>
+                 <hours>8,10,12,14,16,18</hours>
+                 <days>?</days>
+                 <months>*</months>
+                 <weekdays>SUN-FRI</weekdays>
+            </trigger>
+            <trigger name="pipeline-test"
+	         target="org.apache.cocoon.components.cron.CronJob/pipeline-test"
+		 concurrent-runs="true">
+		 <minutes>0</minutes>
+		 <hours>12</hours>
+		 <days>?</days>
+		 <months>*</months>
+		 <weekdays>MON-FRI</weekdays>
+	    </trigger>
+            -->
       </triggers>
     </component>
   

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron.xsamples
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron.xsamples	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/cron/conf/cron.xsamples	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id: cron.xsamples,v 1.4 2004/07/11 19:47:56 antonio Exp $ -->
 <xsamples xpath="/samples" unless="group[@name='Cron']">
 
   <group name="Cron">

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/CocoonPipelineCronJob.java	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,91 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+package org.apache.cocoon.components.cron;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.cocoon.components.cron.ServiceableCronJob;
+
+/**
+ * A simple CronJob which calls an internal cocoon:// pipeline.
+ * 
+ * You must provide it with a &lt;pipeline&gt;pipeline/to/call&lt;/pipeline&gt; parameter in cocoon.xconf
+ * Your supplied pipeline String will have "cocoon://" prepended to it.
+ * If you set info log enabled, this will write the output of the pipeline to the cron log
+ *
+ * @author <a href="mailto:giacomo@apache.org">Giacomo Pati</a>
+ * @author <a href="http://apache.org/~reinhard">Reinhard Poetz</a> 
+ * @author <a href="http://apache.org/~jeremy/">Jeremy Quinn</a>
+ * @version CVS $Id: CocoonPipelineCronJob.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ *
+ * @since 2.1.5
+ */
+public class CocoonPipelineCronJob 
+	extends ServiceableCronJob
+	implements Configurable  {
+
+	private String CONFIG_FILE_PARAM = "pipeline";
+	private String CONFIG_FILE_DEAFAULT= "";
+	private String pipeline = "";
+
+	public void execute(String name) {
+		if (getLogger ().isDebugEnabled ()) {
+			getLogger().debug ("CocoonPipelineCronJob: " + name + ", calling pipeline: " + pipeline);
+		}
+        SourceResolver resolver = null;
+        Source src = null;
+		try {
+			resolver = (SourceResolver)this.manager.lookup (SourceResolver.ROLE);
+			src = resolver.resolveURI ("cocoon://" + pipeline);
+			InputStream is = src.getInputStream();
+			InputStreamReader reader = new InputStreamReader (is);
+			StringBuffer sb = new StringBuffer ();
+			char[] b = new char[8192];
+			int n;
+			while((n = reader.read (b)) > 0) {
+				sb.append (b, 0, n); 
+			}
+			reader.close ();
+			if (getLogger ().isInfoEnabled ()) {
+				getLogger ().info ("CocoonPipelineCronJob: " + name + ", called pipeline: " + pipeline + ", and received following content:\n" + sb.toString() );
+			}
+		} catch(Exception e) {
+			throw new CascadingRuntimeException ("CocoonPipelineCronJob: " + name + ", raised an exception: ", e);
+		} finally {
+			if (resolver != null) {
+				resolver.release (src);
+				this.manager.release (resolver);
+				resolver = null;
+				src = null;
+			}
+		}
+	}
+
+	public void configure(final Configuration config) throws ConfigurationException {
+		pipeline = config.getChild (CONFIG_FILE_PARAM).getValue (CONFIG_FILE_DEAFAULT);
+		if ("".equals (pipeline)) {
+			throw new ConfigurationException ("CocoonPipelineCronJob has no pipeline configured.");
+		}
+	}
+
+}

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzDriverDelegate.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzDriverDelegate.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzDriverDelegate.java	Mon Sep 27 05:52:44 2004
@@ -18,7 +18,6 @@
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.Constants;
 
 import org.quartz.Calendar;
 import org.quartz.CronTrigger;

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobStoreTX.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobStoreTX.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/QuartzJobStoreTX.java	Mon Sep 27 05:52:44 2004
@@ -31,7 +31,7 @@
  */
 public class QuartzJobStoreTX extends JobStoreTX {
 
-	private final Logger logger;
+    private final Logger logger;
     private final ServiceManager manager;
     private final Context context;
     private DriverDelegate delegate;

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.samplesxpipe
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.samplesxpipe	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.samplesxpipe	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id: lucene.samplesxpipe,v 1.5 2004/07/11 19:47:56 antonio Exp $ -->
 <samplesxpipe xpath="/sitemap/pipelines"
        unless="pipeline/match[@pattern='search/**']">
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xconf
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xconf	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xconf	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id$ -->
 <xconf xpath="/cocoon" unless="cocoon-indexer">
 
   <!-- Search:

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xmap
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xmap	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xmap	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id$ -->
 <xmap xpath="/sitemap/components/generators"
       unless="generator[@name='search']">
     <map:generator name="search" src="org.apache.cocoon.generation.SearchGenerator"/>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xroles
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xroles	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xroles	Mon Sep 27 05:52:44 2004
@@ -14,6 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
+<!-- CVS $Id: lucene.xroles,v 1.3 2004/07/11 19:47:56 antonio Exp $ -->
 <xroles xpath="/role-list" unless="role[@name='org.apache.cocoon.components.search.LuceneCocoonIndexer']">
 
   <!-- Lucene Components -->

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xsamples
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xsamples	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/conf/lucene.xsamples	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id: lucene.xsamples,v 1.5 2004/07/11 19:47:56 antonio Exp $ -->
 <xsamples xpath="/samples" unless="group[@name='Lucene']">
 
   <group name="Lucene">

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/ContextAccess.java
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/ContextAccess.java	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,49 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+
+package org.apache.cocoon.bean.query;
+
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.Contextualizable;
+
+
+/**
+ * A component to help you get the Avalon Context.
+ * Probably only a temporary solution to getting this from within a FlowScript.
+ * cocoon.createObject (Packages.org.apache.cocoon.bean.query.ContextAccess);
+ *
+ * @version CVS $Id: ContextAccess.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+
+public class ContextAccess implements Contextualizable {
+
+    private Context avalonContext;
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+     */
+    public void contextualize(Context avalonContext) {
+        this.avalonContext = avalonContext;
+    }
+
+    /**
+     * Return the Avalon Context
+     * @return The context object
+     */
+    public Context getAvalonContext() {
+        return this.avalonContext;
+    }
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneCriterion.java
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneCriterion.java	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,103 @@
+/*
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+*/
+
+package org.apache.cocoon.bean.query;
+
+import org.apache.lucene.search.Query;
+import org.apache.lucene.analysis.Analyzer;
+
+
+/**
+ * The interface of a criterion bean.
+ * <p>
+ *   This component defines an interface for searching.
+ *   The idea is to abstract the process of searching into a Bean to be manipulated by CForms.
+ * </p>
+ *
+ * @version CVS $Id: SimpleLuceneCriterion.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public interface SimpleLuceneCriterion {
+
+    /**
+     * The ANY_FIELD name of this bean.
+     * <p>
+     *   The value representing a query on any field in the index.
+     *   ie. <code>any</code>
+     * </p>
+     */
+    public static final String ANY_FIELD = "any";
+	
+    /**
+     * The ANY_MATCH name of this bean.
+     * <p>
+     *   The value representing a match on any of the terms in this criterion.
+     *   ie. <code>any</code>
+     * </p>
+     */
+    public static final String ANY_MATCH = "any";
+	
+    /**
+     * The ALL_MATCH name of this bean.
+     * <p>
+     *   The value representing a match on all of the terms in this criterion.
+     *   ie. <code>all</code>
+     * </p>
+     */
+    public static final String ALL_MATCH = "all";
+	
+    /**
+     * The LIKE_MATCH name of this bean.
+     * <p>
+     *   The value representing a fuzzy match on any of the terms in this criterion.
+     *   ie. <code>like</code>
+     * </p>
+     */
+    public static final String LIKE_MATCH = "like";
+	
+    /**
+     * The NOT_MATCH name of this bean.
+     * <p>
+     *   The value representing a prohibition on any of the terms in this criterion.
+     *   ie. <code>like</code>
+     * </p>
+     */
+    public static final String NOT_MATCH = "not";
+	
+    /**
+     * The PHRASE_MATCH name of this bean.
+     * <p>
+     *   The value representing a phrase match using all of the terms in this criterion.
+     *   ie. <code>like</code>
+     * </p>
+     */
+    public static final String PHRASE_MATCH = "phrase";
+
+    /**
+     * Gets the <code>org.apache.lucene.search.Query</code> from the Criterion
+     * <p>
+     *   The analyzer specifies which <code>org.apache.lucene.analysis.Analyzer</code> to use for this search
+     * </p>
+     *
+     * @param  analyzer  The <code>org.apache.lucene.analysis.Analyzer</code> to use to extract the Terms from this Criterion
+     */
+    public Query getQuery (Analyzer analyzer);
+
+    /**
+     * Gets the prohibited status from the Criterion
+     */
+    public boolean isProhibited ();
+	
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneCriterionBean.java
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneCriterionBean.java	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,274 @@
+/*
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+*/
+
+package org.apache.cocoon.bean.query;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Vector;
+import org.apache.cocoon.components.search.LuceneXMLIndexer;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.Token;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.FuzzyQuery;
+import org.apache.lucene.search.PhraseQuery;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.TermQuery;
+
+
+/**
+ * The criterion bean.
+ * <p>
+ *   This object defines a <code>Bean</code> for holding a query criterion.<br/>
+ *   The idea is to abstract the process of searching into a Bean to be manipulated by CForms.<br/>
+ *   This Bean is designed to be persistable.
+ * </p>
+ *
+ * @version CVS $Id: SimpleLuceneCriterionBean.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class SimpleLuceneCriterionBean implements SimpleLuceneCriterion {
+
+	/**
+	 * The Bean's ID.
+	 */
+	private Long mId;
+
+	/**
+	 * The Bean's index field to seach in.
+	 */
+	private String mField;
+
+	/**
+	 * The Bean's match value.
+	 */
+	private String mMatch;
+
+	/**
+	 * The Bean's search term.
+	 */
+	private String mValue;
+	
+	/**
+	 * Default constructor.
+	 */
+	public SimpleLuceneCriterionBean() {
+	}
+
+
+	/**
+	 * Utility constructor.
+	 *
+	 * @param match the kind of match to use
+	 * @param field the field to search
+	 * @param value the terms to search for
+	 */
+	public SimpleLuceneCriterionBean(String field, String match, String value) {
+		mField = field;
+		mMatch = match;
+		mValue = value;
+	}
+	
+	/**
+	 * Clones the Bean for the history
+	 *
+	 * @return a deep copy of this Bean. 
+	 */
+	public SimpleLuceneCriterionBean copy () {
+		SimpleLuceneCriterionBean criterion = new SimpleLuceneCriterionBean ();
+		if (mField != null) criterion.setField (new String (mField));
+		if (mMatch != null) criterion.setMatch (new String (mMatch));
+		if (mValue != null) criterion.setValue (new String (mValue));
+		return criterion;
+	}
+
+	/**
+	 * Gets the <code>org.apache.lucene.search.Query</code> from the Criterion
+	 * <p>
+	 *   The analyzer specifies which <code>org.apache.lucene.analysis.Analyzer</code> to use for this search.
+	 * </p>
+	 *
+	 * @param  analyzer  The <code>org.apache.lucene.analysis.Analyzer</code> to use to extract the Terms from this Criterion
+	 */
+	public Query getQuery (Analyzer analyzer) {
+		String field = mField;
+		Query query = null;
+		if (ANY_FIELD.equals (mField)) field = LuceneXMLIndexer.BODY_FIELD;
+		// extract Terms from the query string
+    TokenStream tokens = analyzer.tokenStream (field, new StringReader (mValue));
+    Vector words = new Vector ();
+    Token token;
+    while (true) {
+      try {
+        token = tokens.next ();
+      } catch (IOException e) {
+        token = null;
+      }
+      if (token == null) break;
+      words.addElement (token.termText ());
+    }
+    try {
+      tokens.close ();
+    } catch (IOException e) {} // ignore 
+		
+		// assemble the different matches
+		
+		if (ANY_MATCH.equals (mMatch)) {
+			if (words.size () > 1) {
+				query = new BooleanQuery ();
+				for (int i = 0; i < words.size (); i++) {
+					((BooleanQuery)query).add (new TermQuery (new Term (field, (String)words.elementAt(i))), false, false);
+				}
+			} else if (words.size () == 1) {
+				query = new TermQuery (new Term (field, (String)words.elementAt(0)));
+			}
+		} 
+		
+		if (ALL_MATCH.equals (mMatch)) {
+			if (words.size () > 1) {
+				query = new BooleanQuery ();
+				for (int i = 0; i < words.size (); i++) {
+					((BooleanQuery)query).add (new TermQuery (new Term (field, (String)words.elementAt(i))), true, false);
+				}
+			} else if (words.size () == 1) {
+				query = new TermQuery (new Term (field, (String)words.elementAt(0)));
+			}
+		} 
+		
+		if (NOT_MATCH.equals (mMatch)) {
+			if (words.size () > 1) {
+				query = new BooleanQuery ();
+				for (int i = 0; i < words.size (); i++) {
+					((BooleanQuery)query).add (new TermQuery (new Term (field, (String)words.elementAt(i))), true, true);
+				}
+			} else if (words.size () == 1) {
+				query = new TermQuery (new Term (field, (String)words.elementAt(0)));
+			}
+		} 
+		
+		if (LIKE_MATCH.equals (mMatch)) {
+			if (words.size () > 1) {
+				query = new BooleanQuery ();
+				for (int i = 0; i < words.size (); i++) {
+					((BooleanQuery)query).add (new FuzzyQuery (new Term (field, (String)words.elementAt(i))), false, false);
+				}
+			} else if (words.size () == 1) {
+				query = new FuzzyQuery (new Term (field, (String)words.elementAt(0)));
+			}
+		}
+		
+		if (PHRASE_MATCH.equals (mMatch)) {
+			if (words.size () > 1) {
+				query = new PhraseQuery ();
+				((PhraseQuery)query).setSlop (0);
+				for (int i = 0; i < words.size (); i++) {
+					((PhraseQuery)query).add (new Term (field, (String)words.elementAt(i)));
+				}
+			} else if (words.size () == 1) {
+				query = new TermQuery (new Term (field, (String)words.elementAt(0)));
+			}
+		}
+		return query;
+	}
+	
+	/**
+	 * Gets the prohibited status from the Criterion
+	 */
+	public boolean isProhibited () {
+		if (NOT_MATCH.equals (mMatch)) return true;
+		return false;
+	}
+	
+	
+	// Bean
+	
+	/**
+	 * Gets the Bean's ID
+	 *
+	 * @return the <code>Long</code> ID of the Bean. 
+	 */
+	public Long getId() {
+		return mId;
+	}
+	
+	/**
+	 * Sets the Bean's ID
+	 *
+	 * @param id the <code>Long</code> ID of the Bean. 
+	 */
+	public void setId(Long id) {
+		mId = id;
+	}
+	
+	/**
+	 * Gets the Bean's field
+	 *
+	 * @return the <code>String</code> field of the Bean. 
+	 */
+	public String getField() {
+		return mField;
+	}
+	
+	/**
+	 * Sets the Bean's field.<br/>
+	 * ie. which field would you like this Criterion to search in.
+	 *
+	 * @param field the <code>String</code> field of the Bean. 
+	 */
+	public void setField(String field) {
+		mField = field;
+	}
+	
+	/**
+	 * Gets the Bean's match
+	 *
+	 * @return the <code>String</code> match of the Bean. 
+	 */
+	public String getMatch() {
+		return mMatch;
+	}
+	
+	/**
+	 * Sets the Bean's match.<br/>
+	 * ie. what kind of match do you want performed by this Criterion.
+	 *
+	 * @param match the <code>String</code> match of the Bean. 
+	 */
+	public void setMatch(String match) {
+		mMatch = match;
+	}
+	
+	/**
+	 * Gets the Bean's value
+	 *
+	 * @return the <code>String</code> value of the Bean. 
+	 */
+	public String getValue() {
+		return mValue;
+	}
+	
+	/**
+	 * Sets the Bean's value.<br/>
+	 * ie. the string of search terms for this <code>Criterion</code>.
+	 *
+	 * @param value the <code>String</code> value of the Bean. 
+	 */
+	public void setValue(String value) {
+		mValue = value.trim ();
+	}
+
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneQuery.java
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneQuery.java	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,67 @@
+/*
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+*/
+
+package org.apache.cocoon.bean.query;
+
+import java.io.IOException;
+import java.util.List;
+import org.apache.cocoon.components.search.LuceneCocoonSearcher;
+import org.apache.cocoon.ProcessingException;
+
+/**
+ * The interface of a query bean.
+ * <p>
+ *   This component defines an interface for searching.
+ *   The idea is to abstract the process of searching into a Bean to be manipulated by CForms.
+ * </p>
+ *
+ * @version CVS $Id: SimpleLuceneQuery.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public interface SimpleLuceneQuery {
+
+    /**
+     * The AND_BOOL name of this bean.
+     * <p>
+     *   The value representing a Boolean AND operation.
+     *   ie. <code>and</code>
+     * </p>
+     */
+    public static final String AND_BOOL = "and";
+
+    /**
+     * The OR_BOOL name of this bean.
+     * <p>
+     *   The value representing a Boolean OR operation.
+     *   ie. <code>or</code>
+     * </p>
+     */
+    public static final String OR_BOOL = "or";
+
+    /**
+     * Gets the Bean to perform it's query
+     * <p>
+     *   The searcher specifies which LuceneCocoonSearcher to use for this search
+     *   It needs to have been initialised properly before use
+     * </p>
+     *
+     * @param  searcher  The <code>LuceneCocoonSearcher</code> to use for this search
+     * @return a List of Maps, each representing a Hit. 
+     * @exception  ProcessingException thrown by the searcher
+     * @exception  IOException thrown when the searcher's directory cannot be found
+     */
+    public List search (LuceneCocoonSearcher searcher)  throws IOException, ProcessingException;
+
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneQueryBean.java
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneQueryBean.java	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,410 @@
+/*
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+*/
+
+package org.apache.cocoon.bean.query;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Date;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Enumeration;
+
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.cocoon.components.search.LuceneCocoonSearcher;
+import org.apache.cocoon.ProcessingException;
+
+
+/**
+ * The query bean.
+ * <p>
+ *   This object defines a <code>Bean</code> for searching.<br/>
+ *   The idea is to abstract the process of searching into a Bean to be manipulated by CForms.<br/>
+ *   This Bean is designed to be persistable.
+ * </p>
+ *
+ * @version CVS $Id: SimpleLuceneQueryBean.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class SimpleLuceneQueryBean implements SimpleLuceneQuery {
+
+	/**
+	 * The DEFAULT_PAGE_SIZE of this bean.
+	 * ie. <code>20</code>
+	 */
+	public static Long DEFAULT_PAGE_SIZE = new Long (20);
+
+	/**
+	 * The SCORE_FIELD of this bean.
+	 * This is the key of the Lucene Score as output by this Bean in each hit.
+	 * ie. <code>_lucene-score_</code>
+	 */
+	public static String SCORE_FIELD = "_lucene-score_";
+
+	/**
+	 * The INDEX_FIELD of this bean.
+	 * This is the key of the hit index as output by this Bean in each hit.
+	 * ie. <code>_lucene-index_</code>
+	 */
+	public static String INDEX_FIELD = "_lucene-index_";
+
+	/**
+	 * The date this Query was created.
+	 */
+	private Date mDate; 
+
+	/**
+	 * The Bean's list of Criteria.
+	 */
+	private List mCriteria;
+
+	/**
+	 * The Bean's ID.
+	 */
+	private Long mId;
+
+	/**
+	 * The Bean's current page.
+	 */
+	private Long mPage; 
+
+	/**
+	 * The Bean's page isze.
+	 */
+	private Long mSize; 
+
+	/**
+	 * The Bean's hit count.
+	 */
+	private Long mTotal; 
+
+	/**
+	 * The Bean's query boolean.
+	 */
+	private String mBool;
+
+	/**
+	 * The Bean's query name.
+	 */
+	private String mName;
+
+	/**
+	 * The Bean's query type.
+	 */
+	private String mType;
+
+	/**
+	 * Default constructor.
+	 */
+	public SimpleLuceneQueryBean() {
+	}
+
+	/**
+	 * Utility constructor.
+	 *
+	 * @param type the type of this query
+	 * @param bool the kind of boolean opperation to apply to each of it's Criteria
+	 * @param match the kind of match to use for the generated <code>Criterion</code>
+	 * @param field the field to search for the generated <code>Criterion</code>
+	 * @param query the terms to search for the generated <code>Criterion</code>
+	 */
+	public SimpleLuceneQueryBean(String type, String bool, String match, String field, String query) {
+		mName = "My Query";
+		mType = type;
+		mBool = bool;
+		mSize = DEFAULT_PAGE_SIZE;
+		mPage = new Long (0);
+		mTotal = null;
+		this.addCriterion (new SimpleLuceneCriterionBean (field, match, query));
+	}
+	
+	/**
+	 * Clones the Bean for the history
+	 *
+	 * @return a deep copy of this Bean. 
+	 */
+	public SimpleLuceneQuery copy() {
+		SimpleLuceneQueryBean query = new SimpleLuceneQueryBean ();
+		if (mName != null) query.setName (new String (mName));
+		if (mType != null) query.setType (new String (mType));
+		if (mBool != null) query.setBool (new String (mBool));
+		query.setSize (DEFAULT_PAGE_SIZE);
+		query.setPage (new Long (0));
+		query.setTotal (null);
+		if (mDate != null) {
+			query.setDate (new Date (mDate.getTime ()));
+		} else {
+			query.setDate (new Date ());
+		}
+		Iterator i = this.getCriteria().iterator ();
+		while (i.hasNext()) query.addCriterion (((SimpleLuceneCriterionBean)i.next()).copy ());
+		return query;
+	}
+	
+	/**
+	 * Gets the Bean to perform it's query
+	 * <p>
+	 *   The searcher specifies which LuceneCocoonSearcher to use for this search.<br/>
+	 *   It needs to have been initialised properly before use.<br/>
+	 *   Each <code>Map</code> in the <code>List</code> returned by this method contains:
+	 *   <ul>
+	 *     <li>Each stored field from the Index</li>
+	 *     <li><code>SCORE_FIELD</code> the Lucene score</li>
+	 *     <li><code>INDEX_FIELD</code> the index of the hit</li>
+	 *   </ul>
+	 * </p>
+	 *
+	 * @param  searcher  The <code>LuceneCocoonSearcher</code> to use for this search
+	 * @return a List of Maps, each representing a Hit. 
+	 * @exception  ProcessingException thrown by the searcher
+	 * @exception  IOException thrown when the searcher's directory cannot be found
+	 */
+	public List search (LuceneCocoonSearcher searcher) throws IOException, ProcessingException {
+		BooleanQuery query = new BooleanQuery ();
+		Iterator criteria = mCriteria.iterator ();
+		boolean required = false;
+		if (AND_BOOL.equals (mBool)) required = true;
+		while (criteria.hasNext ()) {
+			SimpleLuceneCriterion criterion = (SimpleLuceneCriterion)criteria.next ();
+			Query subquery = criterion.getQuery (searcher.getAnalyzer ());
+			query.add (subquery, required, criterion.isProhibited ());
+		}
+		// TODO: how can this bean be both Persistable and LogEnabled ?
+		//System.out.println ("SimpleLuceneQueryBean: " + query.toString ());
+		Hits hits = searcher.search (query);
+		mTotal = new Long (hits.length ());
+		mDate = new Date ();
+		return page (hits);
+	}
+
+	/**
+	 * Outputs part of a Hit List according to the Bean's paging properties.
+	 *
+	 * @param  hits  The Lucene Hits you want to page
+	 * @return a List of Maps, each representing a Hit. 
+	 * @exception  IOException thrown when the searcher's directory cannot be found
+	 */
+	private List page (Hits hits)  throws java.io.IOException {
+		ArrayList results = new ArrayList ();
+		int start = mPage.intValue () * mSize.intValue ();
+		if (start > mTotal.intValue ()) start = mTotal.intValue (); 
+		int end = start + mSize.intValue ();
+		if (end > mTotal.intValue ()) end = mTotal.intValue (); 
+		for (int i = start; i < end; i++) {
+			HashMap hit = new HashMap ();
+			hit.put (SCORE_FIELD, new Float (hits.score (i)));
+			hit.put (INDEX_FIELD, new Long (i));
+			Document doc = hits.doc (i);
+			for (Enumeration e = doc.fields (); e.hasMoreElements (); ) {
+				Field field = (Field)e.nextElement ();
+				if (field.name ().equals (SCORE_FIELD)) continue;
+				if (field.name ().equals (INDEX_FIELD)) continue;
+				hit.put (field.name (), field.stringValue ());
+      }
+			results.add (hit);
+		}
+		return (results);
+	}
+	
+	/**
+	 * Gets the Bean's ID.
+	 *
+	 * @return the <code>Long</code> ID of the Bean. 
+	 */
+	public Long getId() {
+		return mId;
+	}
+	
+	/**
+	 * Sets the Bean's ID.
+	 *
+	 * @param id the <code>Long</code> ID of the Bean. 
+	 */
+	public void setId(Long id) {
+		mId = id;
+	}
+	
+	/**
+	 * Gets the Bean's name.
+	 *
+	 * @return the <code>String</code> name of the Bean. 
+	 */
+	public String getName() {
+		return mName;
+	}
+	
+	/**
+	 * Sets the Bean's Name.
+	 *
+	 * @param name the <code>String</code> name of the Bean. 
+	 */
+	public void setName(String name) {
+		mName = name;
+	}
+
+	/**
+	 * Gets the Bean's type.
+	 *
+	 * @return the <code>String</code> type of the Bean. 
+	 */
+	public String getType() {
+		return mType;
+	}
+	
+	/**
+	 * Sets the Bean's type.
+	 *
+	 * @param type the <code>String</code> type of the Bean. 
+	 */
+	public void setType(String type) {
+		mType = type;
+	}
+
+	/**
+	 * Gets the Bean's boolean operator.
+	 *
+	 * @return the <code>String</code> boolean of the Bean. 
+	 */
+	public String getBool() {
+		return mBool;
+	}
+	
+	/**
+	 * Sets the Bean's boolean operator.
+	 * ie. which kind of boolean operation do you want performed on each <code>Criterion</code>.
+	 *
+	 * @param bool the <code>String</code> boolean of the Bean. 
+	 */
+	public void setBool(String bool) {
+		mBool = bool;
+	}
+	
+	/**
+	 * Gets the Bean's page size
+	 *
+	 * @return the <code>Long</code> page size of the Bean. 
+	 */
+	public Long getSize() {
+		return mSize;
+	}
+	
+	/**
+	 * Sets the Bean's page size.
+	 * ie. how many hits do you want this Bean to show on in page.
+	 *
+	 * @param size the <code>Long</code> page size of the Bean. 
+	 */
+	public void setSize(Long size) {
+		mSize = size;
+	}
+	
+	/**
+	 * Gets the Bean's page index
+	 *
+	 * @return the <code>Long</code> page index of the Bean. 
+	 */
+	public Long getPage() {
+		return mPage;
+	}
+	
+	/**
+	 * Sets the Bean's page index.
+	 * ie. which page do you want this Bean to show.
+	 *
+	 * @param page the <code>Long</code> page index of the Bean. 
+	 */
+	public void setPage(Long page) {
+		mPage = page;
+	}
+
+	/**
+	 * Gets the Bean's hit count.
+	 *
+	 * @return the <code>Long</code> hit count of the Bean. 
+	 */
+	public Long getTotal() {
+		return mTotal;
+	}
+	
+	/**
+	 * Sets the Bean's hit count.
+	 *
+	 * @param total the <code>Long</code> hit count of the Bean. 
+	 */
+	public void setTotal(Long total) {
+		mTotal = total;
+	}
+
+	/**
+	 * Gets the Bean's inception date.
+	 *
+	 * @return the <code>Date</code> of the Bean. 
+	 */
+	public Date getDate() {
+		return mDate;
+	}
+	
+	/**
+	 * Sets the Bean's inception date.
+	 *
+	 * @param date the <code>Date</code> inception date of the Bean. 
+	 */
+	public void setDate(Date date) {
+		mDate = date;
+	}
+
+	/**
+	 * Gets the Bean's criteria.
+	 *
+	 * @return the <code>List</code> of Bean Query criteria. 
+	 */
+	public List getCriteria() {
+		return mCriteria;
+	}
+	
+	/**
+	 * Sets the Bean's criteria.
+	 *
+	 * @param criteria the <code>List</code> of Bean Query criteria. 
+	 */
+	public void setCriteria(List criteria) {
+		mCriteria = criteria;
+	}
+
+	/**
+	 * Adds a <code>Criterion</code> the Bean.
+	 *
+	 * @param criterion the <code>SimpleLuceneCriterionBean</code> to add to the Bean. 
+	 */
+	public void addCriterion(SimpleLuceneCriterionBean criterion) {
+		if (mCriteria == null) mCriteria = new ArrayList ();
+		mCriteria.add (criterion);
+	}
+
+	/**
+	 * Removes a <code>Criterion</code> from the Bean.
+	 *
+	 * @param criterion the <code>SimpleLuceneCriterionBean</code> to remove from the Bean. 
+	 */
+	public void removeCriterion(SimpleLuceneCriterionBean criterion) {
+		if (mCriteria != null) mCriteria.remove (criterion);
+	}
+	
+}

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/components/search/LuceneCocoonSearcher.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/components/search/LuceneCocoonSearcher.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/components/search/LuceneCocoonSearcher.java	Mon Sep 27 05:52:44 2004
@@ -19,8 +19,10 @@
 import org.apache.cocoon.ProcessingException;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.Query;
 import org.apache.lucene.store.Directory;
 
+
 /**
  * The avalon behavioural component interface of a searcher.
  * <p>
@@ -30,7 +32,7 @@
  * </p>
  *
  * @author <a href="mailto:berni_huber@a1.net">Bernhard Huber</a>
- * @version CVS $Id: LuceneCocoonSearcher.java,v 1.3 2004/03/05 13:01:59 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public interface LuceneCocoonSearcher extends Component
 {
@@ -64,6 +66,21 @@
 
 
     /**
+     * Gets the analyzer attribute of the LuceneCocoonSearcher object
+     * <p>
+     *   The analyzer determines the tokenization of the query,
+     *   and strategy of matching.
+     * </p>
+     * <p>
+     *   The analyzer class defined here should be equivalent to the analyzer
+     *   class used when creating the index used for searching.
+     * </p>
+     *
+     * @since 2.1.6
+     */
+    Analyzer getAnalyzer();
+
+    /**
      * Sets the directory attribute of the LuceneCocoonSearcher object
      * <p>
      *   The directory specifies the directory used for looking up the
@@ -89,5 +106,18 @@
      * @since
      */
     Hits search(String query_string, String default_field) throws ProcessingException;
+
+    /**
+     * Search using a Lucene Query object, returning zero, or more hits.
+     * <p>
+     * </p>
+     *
+     * @param  query                    A lucene query
+     * @return                          Hits zero or more hits matching the query string
+     * @exception  ProcessingException  throwing due to processing errors while
+     *   looking up the index directory, parsing the query string, generating the hits.
+     * @since 2.1.6
+     */
+    Hits search(Query query) throws ProcessingException;
 }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/components/search/SimpleLuceneCocoonSearcherImpl.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/components/search/SimpleLuceneCocoonSearcherImpl.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/components/search/SimpleLuceneCocoonSearcherImpl.java	Mon Sep 27 05:52:44 2004
@@ -57,7 +57,7 @@
  * </p>
  *
  * @author <a href="mailto:berni_huber@a1.net">Bernhard Huber</a>
- * @version CVS $Id: SimpleLuceneCocoonSearcherImpl.java,v 1.6 2004/03/05 13:01:59 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class SimpleLuceneCocoonSearcherImpl extends AbstractLogEnabled
          implements LuceneCocoonSearcher, Configurable, Serviceable, Disposable, Recyclable
@@ -195,6 +195,13 @@
         this.analyzer = analyzer;
     }
 
+    /**
+     * get the analyzer.
+     *
+     */
+    public Analyzer getAnalyzer() {
+        return this.analyzer;
+    }
 
     /**
      *Sets the directory attribute of the SimpleLuceneCocoonSearcherImpl object
@@ -361,6 +368,29 @@
         return hits;
     }
 
+    /**
+     * Search lucene index.
+     * This method is designed to be used by other components, or Flowscripts
+     *
+     * @param  query                    the lucene Query
+     * @return                          lucene Hits
+     * @exception  ProcessingException  if its not possible do run the query
+     */
+    public Hits search(Query query) throws ProcessingException {
+        Hits hits = null;
+        try {
+            // release index searcher for each new search
+            releaseIndexSearcher();
+
+            IndexSearcher indexSearcher = new IndexSearcher(getReader());
+            hits = indexSearcher.search(query);
+            // do not close indexSearcher now, as using hits needs an
+            // opened indexSearcher indexSearcher.close();
+        } catch (IOException ioe) {
+            throw new ProcessingException("Cannot access hits", ioe);
+        }
+        return hits;
+    }
 
     /**
      * Release the index searcher.

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/create-index.xsp
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/create-index.xsp	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/create-index.xsp	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id$ -->
 <xsp:page language="java"
           xmlns:xsp="http://apache.org/xsp"
           xmlns:xsp-request="http://apache.org/xsp/request/2.0">

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/document-files.xsp
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/document-files.xsp	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/document-files.xsp	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id$ -->
 <xsp:page language="java"
           xmlns:xsp="http://apache.org/xsp"
           xmlns:xsp-request="http://apache.org/xsp/request/2.0">

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/query.js
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/query.js	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,192 @@
+/*
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+*/
+
+// flowscripts for using the Query Bean
+// $Id: query.js 30943 2004-07-29 20:24:08Z vgritsenko $
+
+
+cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
+
+importClass(Packages.org.apache.cocoon.Constants);
+importPackage(Packages.org.apache.cocoon.bean.query);
+importClass(Packages.org.apache.cocoon.components.search.LuceneCocoonSearcher);
+importClass(Packages.org.apache.cocoon.components.search.LuceneCocoonHelper);
+
+
+var SESSION_ATTR = "_query_bean_history_"; // the name of the Session Attribute used by this code
+var STANDARD_ANALYZER = "org.apache.lucene.analysis.standard.StandardAnalyzer";
+
+// display the User's Search History
+function history() {
+	var history = getHistory();
+	var count = history.size();
+	var histlist = new java.util.ArrayList(count);
+	var index = 0;
+	for (var position = 0; position < count; position++) {
+		index = count - position - 1; // reverse the order
+		histlist.add(position, {id: new java.lang.Long(index), query: history.get(index)});
+	}
+	cocoon.sendPage(cocoon.parameters["screen"], {history: histlist});
+}
+
+// perform Searches
+function simpleLuceneQuery() {
+	var screen = cocoon.parameters["screen"];
+	var type = cocoon.parameters["type"];
+	var historyid = cocoon.parameters["id"];
+	var directory = cocoon.parameters["lucene-directory"];
+	var query = null;
+	var results = null;
+	var history = getHistory();
+	var searcher = cocoon.getComponent(LuceneCocoonSearcher.ROLE);
+	var contextAccess = cocoon.createObject(ContextAccess);
+	var avalonContext = contextAccess.getAvalonContext();
+	var page = null;
+	var match = "".equals(cocoon.parameters["match"]) ? SimpleLuceneCriterion.ANY_MATCH : cocoon.parameters["match"];
+	var field = "".equals(cocoon.parameters["field"]) ? SimpleLuceneCriterion.ANY_FIELD : cocoon.parameters["field"];
+	try {
+		if ( !"".equals(cocoon.parameters["page"]) ) page = new java.lang.Long(cocoon.parameters["page"]);
+		if ( !"".equals(cocoon.parameters["query"]) ) { // test for: quick ?query
+			query = new SimpleLuceneQueryBean(type, null, match, field, cocoon.parameters["query"]);
+		} else if ( "".equals(historyid) ) {            // test for: new query
+			query = new SimpleLuceneQueryBean(type, null, match, field, "");
+			edit(query);
+		} else {
+			try {
+				var edition = history.get(historyid);
+				if (page == null) {                          // edit a query already in the history
+					query = edition.copy();                   // clone it first so history items are separate
+					edit(query);    
+				} else {                                     // page a query already in the history
+					query = edition;
+					query.page = page;
+				}		
+			} catch (e) {
+				cocoon.sendPage("screen/error", {message: "search.error.nohistory"});
+				return;
+			}
+		}
+		if (query != null) {
+			try {
+				var index = getLuceneDirectory(avalonContext, directory)
+				if (index == null) {
+					cocoon.sendPage("screen/error", {message: "search.error.noindex"});
+					return;
+				}
+				searcher.setDirectory(index);
+				if (searcher.getAnalyzer() == null) searcher.setAnalyzer(LuceneCocoonHelper.getAnalyzer(STANDARD_ANALYZER));
+				results = query.search(searcher);
+			} catch (e) {
+				cocoon.log.error(e);
+				cocoon.sendPage("screen/error", {message: e});
+				return;
+			}
+			var nav = pagerNavigation(query.total, query.page, query.size);
+			if (page == null) {
+				history.add(query); 													// add a fresh query to the history
+			} else {
+				history.remove(query); 											// move move a paged query to the top
+				history.add(query);
+			}
+			historyid = new java.lang.Long(history.size() -1); 
+			cocoon.sendPage(screen, {result: { results: results, nav: nav, query: query, id: historyid }});
+		} else {
+			cocoon.sendPage("screen/error", {message: "search.error.noquery"});
+		}
+	} catch (e) {
+		cocoon.log.error(e);
+		cocoon.sendPage("screen/error", {message: e});
+	} finally {
+		cocoon.releaseComponent(searcher);
+		cocoon.disposeObject(contextAccess);
+	}
+}
+
+// allow the user to edit the query
+function edit(query) {
+	var form = new Form(cocoon.parameters["form-definition"]);
+	form.createBinding(cocoon.parameters["bindingURI"]);
+	form.load(query);
+	form.showForm(cocoon.parameters["form"]);
+	if ("submit".equals(form.submitId)) {
+		form.save(query);
+	}
+}
+
+// get or setup the User's History in the Session
+function getHistory() {
+	var history = cocoon.session.getAttribute(SESSION_ATTR);
+	if (history == null) {
+		history = new java.util.ArrayList();
+		cocoon.session.setAttribute(SESSION_ATTR, history);
+	}
+	return history;
+}
+
+// Utility function to work out the directory to use as the Lucene Index 
+function getLuceneDirectory(avalonContext, directory) {
+	var index = new java.io.File(directory);
+	if (!index.isAbsolute()) {
+		var workDir = avalonContext.get(Constants.CONTEXT_WORK_DIR);
+		index = new java.io.File(workDir, directory);
+	}
+	if (!index.exists()) {
+		return null;
+	} else {
+		return LuceneCocoonHelper.getDirectory(index, false);
+	}
+}
+
+// Utility function to create a 'paging record' for the display of long paged lists of records 
+function pagerNavigation(total, page, size) {
+	var pages = Math.ceil(total/size);
+	var index = new java.util.ArrayList();
+	var off = 5; // half the max # of slots to see
+	var start = 0;
+	var end = pages;
+	if (pages > (off*2)) {
+		if (page < off) { // if we are close to the left
+			start = 0;
+			end = start + (off*2);
+		} else if (page > (pages - off)) { // if we are close to the right
+			start = pages - (off*2);
+			end = pages;
+		} else { // we are somewhere in the middle
+			start = page - off;
+			end = page.intValue() + off;
+		}
+	} 
+	for (var i = start; i < end; i++) index.add(new java.lang.Integer(i));
+	var firstIndex = 0;
+	var lastIndex = 0;
+	try {
+		firstIndex = index.get(0);
+		lastIndex = index.get(index.size()-1);
+	} catch (e) {}
+	return (
+		{ 
+			total: total, 
+			next: total > (page.intValue() * size.intValue()) + size.intValue() ? new java.lang.Integer(page.intValue() + 1) : null, 
+			prev: page > 0 ? new java.lang.Integer(page - 1) : null, 
+			size: new java.lang.Integer(size), 
+			page: new java.lang.Integer(page), 
+			pages: new java.lang.Integer(pages),
+			index: index,
+			firstIndex: firstIndex,
+			lastIndex: lastIndex
+		}
+	);
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/advanced-binding.xml
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/advanced-binding.xml	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!-- The CForms Binding for editing an advanced query -->
+<!-- $Id: advanced-binding.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+<fb:context 
+	xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" 
+	xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" 
+	path="/"
+	>
+	
+  <fb:value id="name" path="name"/>
+  <fb:value id="type" path="type"/>
+  <fb:value id="bool" path="bool"/>
+
+  <fb:value id="size" path="size"/>
+  <fb:value id="page" path="page"/>
+  <fb:value id="total" path="total"/>
+
+  <fb:repeater id="criteria" parent-path="." row-path="criteria">
+  	<fb:identity><fb:value path="value" id="value"/></fb:identity>
+
+		<fb:on-bind>
+			<fb:value id="value" path="value"/>
+			<fb:value id="field" path="field"/>
+			<fb:value id="match" path="match"/>
+		</fb:on-bind>
+		
+    <fb:on-delete-row>
+      <fb:delete-node/>
+    </fb:on-delete-row>
+    <fb:on-insert-row>
+			<fb:insert-bean classname="org.apache.cocoon.bean.query.SimpleLuceneCriterionBean" addmethod="addCriterion"/>
+    </fb:on-insert-row>
+
+  </fb:repeater>
+
+</fb:context>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/advanced-fields.xml
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/advanced-fields.xml	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+<fd:selection-list
+	xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" 
+	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+>
+<!-- The field selectionlist for the CForms Model for editing an advanced query -->
+<!-- $Id: advanced-fields.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+
+<!-- 
+	Edit this list to suit the way your content is indexed.
+	
+	Make an fd:item for each field you want the user to be able to search
+	The @value represents the name of the Lucene Index field.
+	
+	The special value of "any" is reserved to mean "any field".
+-->
+	<fd:item value="any">
+		<fd:label><i18n:text i18n:catalogue="local">field.any.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="title">
+		<fd:label><i18n:text i18n:catalogue="local">field.title.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="question">
+		<fd:label><i18n:text i18n:catalogue="local">field.question.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="answer">
+		<fd:label><i18n:text i18n:catalogue="local">field.answer.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="source">
+		<fd:label><i18n:text i18n:catalogue="local">field.source.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="s1@title">
+		<fd:label><i18n:text i18n:catalogue="local">field.s1@title.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="s2@title">
+		<fd:label><i18n:text i18n:catalogue="local">field.s2@title.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="person@name">
+		<fd:label><i18n:text i18n:catalogue="local">field.person@name.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="p">
+		<fd:label><i18n:text i18n:catalogue="local">field.p.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="link">
+		<fd:label><i18n:text i18n:catalogue="local">field.link.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="code">
+		<fd:label><i18n:text i18n:catalogue="local">field.code.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="abstract">
+		<fd:label><i18n:text i18n:catalogue="local">field.abstract.label</i18n:text></fd:label>
+	</fd:item>
+</fd:selection-list>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/advanced-model.xml
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/advanced-model.xml	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!-- The CForms Model for editing an advanced query -->
+<!-- $Id: advanced-model.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+<fd:form 
+	xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" 
+	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+>
+
+  <fd:widgets>
+
+    <fd:messages id="messages">
+      <fd:label><i18n:text i18n:catalogue="local">message.label</i18n:text></fd:label>
+    </fd:messages>
+
+		<fd:output id="id">
+			<fd:datatype base="string"/>
+		</fd:output>
+
+		<fd:field id="name" required="true">
+			<fd:label><i18n:text i18n:catalogue="local">query.name.label</i18n:text>: </fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">query.name.hint</i18n:text></fd:hint>
+			<fd:datatype base="string"/>
+		</fd:field>
+
+		<fd:output id="type">
+			<fd:datatype base="string"/>
+		</fd:output>
+
+		<fd:field id="bool" required="true">
+			<fd:label><i18n:text i18n:catalogue="local">query.bool.label</i18n:text>: </fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">query.bool.hint</i18n:text></fd:hint>
+			<fd:datatype base="string"/>
+			<!-- the @value(s) of this selection-list are bound to SimpleLuceneQuery -->
+			<fd:selection-list>
+				<fd:item value="or">
+					<fd:label><i18n:text i18n:catalogue="local">search.or.bool</i18n:text></fd:label>
+				</fd:item>
+				<fd:item value="and">
+					<fd:label><i18n:text i18n:catalogue="local">search.and.bool</i18n:text></fd:label>
+				</fd:item>
+			</fd:selection-list>
+		</fd:field>
+
+		<fd:field id="size" required="true">
+			<fd:label><i18n:text i18n:catalogue="local">paging.size.label</i18n:text>: </fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">paging.size.hint</i18n:text></fd:hint>
+			<fd:datatype base="long"/>
+			<fd:selection-list>
+				<fd:item value="10"/>
+				<fd:item value="20"/>
+				<fd:item value="30"/>
+				<fd:item value="40"/>
+				<fd:item value="50"/>
+			</fd:selection-list>
+		</fd:field>
+
+		<fd:field id="page" required="true">
+			<fd:label><i18n:text i18n:catalogue="local">paging.page.label</i18n:text>: </fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">paging.page.hint</i18n:text></fd:hint>
+			<fd:datatype base="long"/>
+		</fd:field>
+
+		<fd:output id="total">
+			<fd:label><i18n:text i18n:catalogue="local">paging.total.label</i18n:text>: </fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">paging.total.hint</i18n:text></fd:hint>
+			<fd:datatype base="long"/>
+		</fd:output>
+
+		<fd:submit id="cancel" action-command="cancel" validate="false">
+			<fd:label><i18n:text i18n:catalogue="local">cancel.label</i18n:text></fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">cancel.hint</i18n:text></fd:hint>
+		</fd:submit> 
+
+		<fd:submit id="submit" action-command="submit" validate="true">
+			<fd:label><i18n:text i18n:catalogue="local">submit.label</i18n:text></fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">submit.hint</i18n:text></fd:hint>
+		</fd:submit> 
+
+    <fd:repeater id="criteria">
+      <fd:widgets>
+        
+        <fd:field id="value" required="true">
+          <fd:label><i18n:text i18n:catalogue="local">criterion.value.label</i18n:text>: </fd:label>
+          <fd:hint><i18n:text i18n:catalogue="local">criterion.value.hint</i18n:text></fd:hint>
+					<fd:datatype base="string"/>
+        </fd:field>
+				
+				<fd:field id="field" required="true">
+					<fd:label><i18n:text i18n:catalogue="local">criterion.field.label</i18n:text>: </fd:label>
+					<fd:hint><i18n:text i18n:catalogue="local">criterion.field.hint</i18n:text></fd:hint>
+					<fd:datatype base="string">
+						<fd:validation>
+							<fd:length min="2" max="64"/>
+						</fd:validation>
+					</fd:datatype>
+					<fd:selection-list src="screens/advanced-fields.xml"/>
+				</fd:field>
+
+				<fd:field id="match" required="true">
+					<fd:label><i18n:text i18n:catalogue="local">criterion.match.label</i18n:text>: </fd:label>
+					<fd:hint><i18n:text i18n:catalogue="local">criterion.match.hint</i18n:text></fd:hint>
+					<fd:datatype base="string"/>
+					<!-- the @value(s) of this selection-list are bound to SimpleLuceneCriterion -->
+					<fd:selection-list>
+						<fd:item value="any">
+							<fd:label><i18n:text i18n:catalogue="local">search.any.match</i18n:text></fd:label>
+						</fd:item>
+						<fd:item value="all">
+							<fd:label><i18n:text i18n:catalogue="local">search.all.match</i18n:text></fd:label>
+						</fd:item>
+						<fd:item value="like">
+							<fd:label><i18n:text i18n:catalogue="local">search.like.match</i18n:text></fd:label>
+						</fd:item>
+						<fd:item value="phrase">
+							<fd:label><i18n:text i18n:catalogue="local">search.phrase.match</i18n:text></fd:label>
+						</fd:item>
+						<fd:item value="not">
+							<fd:label><i18n:text i18n:catalogue="local">search.not.match</i18n:text></fd:label>
+						</fd:item>
+					</fd:selection-list>
+				</fd:field>
+
+				<fd:row-action id="delete" action-command="delete">
+					<fd:label><i18n:text i18n:catalogue="local">criterion.delete.label</i18n:text></fd:label>
+					<fd:hint><i18n:text i18n:catalogue="local">criterion.delete.hint</i18n:text></fd:hint>
+				</fd:row-action>
+
+      </fd:widgets>
+    </fd:repeater>
+    
+    <fd:repeater-action id="addcriterion" action-command="add-row" repeater="criteria">
+      <fd:label><i18n:text i18n:catalogue="local">criterion.add.label</i18n:text></fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">criterion.add.hint</i18n:text></fd:hint>
+    </fd:repeater-action>
+    
+  </fd:widgets>
+</fd:form>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/advanced-template.xml
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/advanced-template.xml	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!-- The CForms Template for editing Query Beans -->
+<!-- $Id: advanced-template.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+<page 
+	xmlns:ft="http://apache.org/cocoon/forms/1.0#template" 
+	xmlns:fi="http://apache.org/cocoon/forms/1.0#instance" 
+	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+>
+	<title><i18n:text i18n:catalogue="local">search.page.title</i18n:text> : <i18n:text i18n:catalogue="local">advanced.page.title</i18n:text></title>
+	<content>
+		<p><i18n:text i18n:catalogue="local">advanced.page.note</i18n:text></p>
+		<ft:form-template action="" method="POST">
+			<ft:continuation-id/>
+			<p class="woody-message"><ft:widget id="messages"/></p>
+			<fi:group>
+				<fi:styling type="fieldset" layout="columns"/>
+				<fi:label><i18n:text i18n:catalogue="local">advanced.query.label</i18n:text></fi:label>
+				<fi:hint>query editor layout</fi:hint>
+				<fi:items>
+					<ft:widget id="name"/>
+					<ft:widget id="bool"/>
+					<ft:widget id="addcriterion"/>
+					<ft:repeater-widget id="criteria">
+						<fi:group>
+							<fi:styling type="fieldset" layout="rows"/>
+							<fi:label><i18n:text i18n:catalogue="local">advanced.criterion.label</i18n:text></fi:label>
+							<fi:items>
+								<ft:widget id="field"/>
+								<ft:widget id="match"/>
+								<ft:widget id="value"/>
+								<ft:widget id="delete"/>
+							</fi:items>
+						</fi:group>
+					</ft:repeater-widget>
+					<ft:widget id="size"/>
+					<ft:widget id="page"/>
+				</fi:items>
+			</fi:group>
+			<i18n:text i18n:catalogue="local">required.note</i18n:text>
+			<ft:widget id="cancel"/>
+			<ft:widget id="submit"/>
+		</ft:form-template>
+	</content>
+</page>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/error.xml
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/error.xml	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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: error.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+<page xmlns:t="http://apache.org/cocoon/templates/jx/1.0"
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+	<title>Error</title>
+	<content>
+		<p><i18n:text i18n:catalogue="local">#{message}</i18n:text></p>
+		<hr/>
+		<p>An error has occurred, please try again. <!--Contact <a href="mailto:">administrator</a> if this problem persists.--></p>
+	</content>
+</page>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/history.xml
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/history.xml	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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: history.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+<page
+	xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+	>
+	<title><i18n:text i18n:catalogue="local">history.page.title</i18n:text></title>
+	<content>
+		<jx:choose>
+			<jx:when test="${history!=null}">
+				<p class="history.title">
+					<i18n:text i18n:catalogue="local">history.queries.title</i18n:text>: 
+					<span class="history.count"><jx:out value="${history.size()}"/></span>
+				</p>
+				<p class="links"> 
+					<a href="simple.html" title="local:new.simple.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">new.simple.label</i18n:text></a>
+					<span> | </span>
+					<a href="advanced.html" title="local:new.advanced.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">new.advanced.label</i18n:text></a>
+					<span> | </span>
+					<a href="../query/" title="local:link.home.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">link.home.label</i18n:text></a>
+				</p>
+				<table width="100%" class="query.history" summary="Query History">
+					<tr>
+						<th align="left"><i18n:text i18n:catalogue="local">history.date.label</i18n:text></th>
+						<th align="left"><i18n:text i18n:catalogue="local">history.title.label</i18n:text></th>
+						<th align="left"><i18n:text i18n:catalogue="local">history.query.label</i18n:text></th>
+						<th align="left"><i18n:text i18n:catalogue="local">history.hits.label</i18n:text></th>
+					</tr>
+					<jx:forEach var="item" items="${history}">
+						<tr valign="top">
+							<td class="history.date">
+								<jx:if test="${item.query.date != null}">
+									<jx:formatDate value="${item.query.date}" type="time"/>
+								</jx:if>
+							</td><td class="history.name">
+								${item.query.name}
+							</td><td class="query.description">
+								<i18n:text i18n:catalogue="local">search.subject.title</i18n:text>
+								<span class="query.bool" title="local:query.bool.hint" i18n:attr="title">
+									<i18n:text i18n:catalogue="local">search.${item.query.bool}.bool</i18n:text>
+								</span>
+								<span class="query.criteria">
+									<jx:choose>
+										<jx:when test="${item.query.criteria.size() == 1}">
+											<i18n:text i18n:catalogue="local">search.criterion.label</i18n:text>:
+										</jx:when>
+										<jx:otherwise>
+											<i18n:text i18n:catalogue="local">search.criteria.label</i18n:text>:
+										</jx:otherwise>
+									</jx:choose>
+								</span>
+								<ul class="query.criteria">
+									<jx:forEach var="crit" items="${item.query.criteria}">
+										<li>
+											<span class="query.criterion-field" title="local:criterion.field.hint" i18n:attr="title">
+												<i18n:text i18n:catalogue="local">search.${crit.field}.field</i18n:text>
+											</span>
+											<span class="query.criterion-match" title="local:criterion.match.hint" i18n:attr="title">
+												<i18n:text i18n:catalogue="local">search.${crit.match}.match</i18n:text>
+											</span>
+											<span class="query.criterion-value" title="local:criterion.value.hint" i18n:attr="title">“${crit.value}”</span>
+										</li>
+									</jx:forEach>
+								</ul>
+							</td><td class="query.hitcount">
+								${item.query.total}
+							</td><td>
+								<a href="${item.query.type}.html?id=${item.id}&amp;page=${item.query.page}" title="local:history.search.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">history.search.label</i18n:text></a>
+							</td><td>
+								<a href="${item.query.type}.html?id=${item.id}" title="local:history.edit.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">history.edit.label</i18n:text></a>
+							</td>
+						</tr>
+					</jx:forEach>
+				</table>
+			</jx:when>
+			<jx:otherwise>
+				<p class="history.queries-none"><i18n:text i18n:catalogue="local">history.none</i18n:text></p>
+			</jx:otherwise>
+		</jx:choose>
+	</content>
+</page>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/index.xml
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/index.xml	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+<page>
+	<title>Query Bean Samples</title>
+	<content>
+		<p>
+			<b>NB. You need to make an index first.</b> <br/>
+			If you have not already made an index of the Cocoon Documentation, you may do so <a href="../document-files.xsp">here</a>.
+		</p>
+		
+		<h3>Search</h3>
+		<p>You can perform any of the following search types:</p>
+		<ul>
+			<li>Quick search: 
+				<form action="simple.html">
+					<input type="text" name="query" size="20" value="cocoon"/>
+					<input type="submit" value="Search" />
+				</form>
+      </li>
+			<li><a href="simple.html">Simple</a> search: perform simple single-criteria searches.</li>
+			<li><a href="advanced.html">Advanced</a> search: perform complex multi-criteria searches.</li>
+		</ul>
+		
+		<h3>Queries</h3>
+		<p>You can view, reuse, and re-edit your previous queries:</p>
+		<ul>
+			<li><a href="history.html">History</a>: your search history.</li>
+		</ul>
+		<p>Or return to the <a href="../welcome">Lucene Samples</a></p>
+		
+		<h3>What it does.</h3>
+		<p>Allows you to assemble complex Lucene Queries without having to use the Lucene Query Language. Keeps a list of the queries you have performed in it's history (for as long as your Session lasts). Allows you to re-use and edit them.</p>
+		
+		<h3>How does it work?</h3>
+		<p>Through a combination of FlowScript (controller), CForms and JXTemplate (view), Beans (model), i18n and the CocoonLuceneSearcher component.</p>
+		<h4>FlowScript</h4>
+		The FlowScript controls the flow of the application, it instansiates Beans, manages the History, chooses which Forms and Screens to display, controls the CocoonLuceneSearcher.
+		<h4>CForms</h4>
+		<p>Cocoon Forms provideds the infrastructure to manipulate the Beans via HTML Forms. That is to change the Properties of the Beans and add and remove Criteria.</p>
+		<h4>JXTemplate</h4>
+		<p>
+			JXTemplate is used to show the results and the history (List of Query Beans).
+		</p><p>
+			The results are in the form of a <code>List</code> of <code>Map</code>s. Each Map represents a search hit. It contains the <code>url</code>, <code>score</code> and <code>rank</code> of the document, plus any Index Fields you arranged to have stored in your Index by Lucene (in this sample, the only stored field is the <code>title</code>).
+		</p><p>
+			The history is in the form of a <code>List</code> of Query Beans.
+		</p>
+		<h4>Beans</h4>
+		<p>The Beans represent an abstract (and potentially persistable) representation of your Query.</p>
+		<h4>i18n</h4>
+		<p>i18n is used to hold all of the display strings used by the Application. Form labels and hints, Query descriptions, Screen labels and hints, Error messages etc.</p>
+		<h4>CocoonLuceneSearcher</h4>
+		<p>This is the Component that does the actual searching. It is provided with the Lucene Directory and a Query by the Query Bean. If you give it a directory parameter that is a single folder name, it uses that folder in the Servlet Engine's Work Directory, if the parameter is an absolute file path, it uses that instead. It uses the default Analyser.</p>
+		
+		<h3>How to reuse this sample in your own projects?</h3>
+			<h4>Reuse the existing forms</h4>
+			<p>If you are happy with the existing forms, then all that really needs to happen to be able to re-use this sample in your own projects it to set up the menu of Search Fields, so they match your Search Index.</p>
+			<p>When the Lucene Index of Cocoon Documentation that this sample uses is created, tags within the documents are turned into Lucene Index Fields, which can be searched individually. The names of these fields are for example: <code>title</code>, <code>question</code>, <code>source</code>, <code>person@name</code> etc.</p>
+			<p>Cocoon Forms is setup to load these menus (selection-lists) from their own files. The <code>simple</code> search form uses the file <a href="screens/simple-fields.xml?cocoon-view=pretty-content">query/screens/simple-fields.xml</a>, while the <code>advanced</code> search form uses the file <a href="screens/advanced-fields.xml?cocoon-view=pretty-content">screens/advanced-fields.xml</a>.</p>
+			<p>Edit these files to match your own Search Index, for example, the item:
+				<pre><![CDATA[
+<fd:item value="title">
+	<fd:label><i18n:text i18n:catalogue="local">field.title.label</i18n:text></fd:label>
+</fd:item>
+]]></pre>
+				makes a menu item using the i18n key <code>field.title.label</code> as the menu text and <code>title</code> as the value, where the value matches one of your Index Fields.
+			</p><p>
+				Once your CForms selection-lists are setup, you will want to edit the existing i18n message keys in <a href="screens/messages.xml?cocoon-view=pretty-content">screens/messages.xml</a> and/or provide new message files in your own language.
+			</p><p>
+				The last thing you may choose to do, is to supply some CSS for the screens. The <a href="screens/history.xml?cocoon-view=pretty-content">history</a> and <a href="screens/results.xml?cocoon-view=pretty-content">results</a> screens supply what is hopefully a rich enough
+collection of CSS Classes, have a look at the HTML output to see what there is.</p>
+
+			<h4>New Forms</h4>
+				<p>If you know CForms, it would be relatively easy to develop your own Forms (<a href="screens/advanced-model.xml?cocoon-view=pretty-content">Model</a>, <a href="screens/advanced-binding.xml?cocoon-view=pretty-content">Binding</a> and <a href="screens/advanced-template.xml?cocoon-view=pretty-content">Template</a>). If you follow the existing naming scheme and you choose a new name for your form, it may not even be necessary to edit the <a href="sitemap.xmap?cocoon-view=pretty-content">Sitemap</a>.
+				</p><p>Depending on how different your Forms are to the supplied ones, it may or may not be necessary to edit the FlowScript. It is quite possible that this will not be required.</p>
+			<h4>New Beans</h4>
+			<p>
+				It is possible to build Lucene Queries that are more complex, or specialised than those produced by these sample Beans. To do so you would have to at least implement your own CriterionBean. You would probably need to rewrite the FlowScript to handle your new Bean. 
+			</p>It would also be possible to implement different kinds of Queries, like those that used the Hibernate Criterion API.<p>
+			</p><p>
+				There are two Interfaces and two Bean Implementations of those Interfaces in the sample. <code>o.a.c.bean.query.SimpleLuceneQuery</code> and <code>o.a.c.bean.query.SimpleLuceneQueryBean</code> represent a Query, which has a Collection of <code>o.a.c.bean.query.SimpleLuceneCriterion</code> (<code>o.a.c.bean.query.SimpleLuceneCriterionBean</code>) Beans.
+			</p><p>
+				The <code>bool</code> property of the QueryBean specifies how the multiple criteria are combined. The <code>field</code> property of the CriterionBean specifies which Index Field to search, the <code>match</code> property specifies how to match that field and the <code>value</code> property, is the string from which Terms are extracted. All the rest is candy.
+			</p>
+			<h4>Persistance</h4>
+			<p>Both the Query and Criterion Beans were designed to be Persistable using one of the Object-Relational mapping tools like Hibernate, JDO, ORO etc. (This is why they have the unused <code>id</code> property).</p>
+	</content>
+</page>
+

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/messages.xml
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/messages.xml	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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: messages.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+<catalogue>
+
+	<!-- these keys are bound to your Index Field names -->
+	<!-- these keys are used for the Field Menu -->
+  <message key="field.abstract.label">Document Abstract</message>
+  <message key="field.answer.label">FAQ Answer</message>
+  <message key="field.any.label">Any Document field</message>
+  <message key="field.code.label">Document Code</message>
+  <message key="field.link.label">Document Link</message>
+  <message key="field.p.label">Document Paragraph</message>
+  <message key="field.person@name.label">Author Name</message>
+  <message key="field.question.label">FAQ Question </message>
+  <message key="field.s1@title.label">Level 1 Section Title</message>
+  <message key="field.s2@title.label">Level 2 Section Title</message>
+  <message key="field.source.label">Sample Source Code</message>
+  <message key="field.title.label">Document Title</message>
+
+	<!-- these keys are bound to your Index Field names -->
+	<!-- these keys are used to describe the queries -->
+  <message key="search.abstract.field">document abstract</message>
+  <message key="search.answer.field">faq answer</message>
+  <message key="search.any.field">any field</message>
+  <message key="search.code.field">document code</message>
+  <message key="search.link.field">document link</message>
+  <message key="search.p.field">document paragraph</message>
+  <message key="search.person@name.field">author name</message>
+  <message key="search.question.field">faq question</message>
+  <message key="search.s1@title.field">section 1 title </message>
+  <message key="search.s2@title.field">section 2 title</message>
+  <message key="search.source.field">sample source</message>
+  <message key="search.title.field">document title</message>
+  
+  <!-- advanced query -->
+  <message key="advanced.criterion.label">Criterion</message>
+  <message key="advanced.page.note">You can edit and save this query for later use.</message>
+  <message key="advanced.page.title">An advanced query</message>
+  <message key="advanced.query.label">Query</message>
+	<!-- cancel button -->
+  <message key="cancel.hint">cancel this edit</message>
+  <message key="cancel.label">Cancel</message>
+	<!-- editing criteria -->
+  <message key="criterion.add.hint">add a new criterion</message>
+  <message key="criterion.add.label">Add Criterion</message>
+  <message key="criterion.delete.hint">delete this criterion</message>
+  <message key="criterion.delete.label">-</message>
+  <message key="criterion.field.hint">which fields to search in</message>
+  <message key="criterion.field.label">Search Field</message>
+  <message key="criterion.match.hint">the way your search term is matched</message>
+  <message key="criterion.match.label">Match</message>
+  <message key="criterion.value.hint">the word or words you are searching for</message>
+  <message key="criterion.value.label">Word or Words</message>
+	<!-- displaying history -->
+  <message key="history.date.label">Time</message>
+  <message key="history.edit.hint">edit this query</message>
+  <message key="history.edit.label">Edit</message>
+  <message key="history.hits.label">Hits</message>
+  <message key="history.none">No History</message>
+  <message key="history.page.title">Query Bean : History</message>
+  <message key="history.queries.title">Queries</message>
+  <message key="history.query.label">Query</message>
+  <message key="history.search.hint">re-search this query</message>
+  <message key="history.search.label">Search</message>
+  <message key="history.title.label">Title</message>
+	<!-- linking -->
+  <message key="link.home.hint">the query bean samples home page</message>
+  <message key="link.home.label">Home</message>
+	<!-- new queries -->
+  <message key="new.advanced.hint">perform complex multi-criteria searches</message>
+  <message key="new.advanced.label">New Advanced Query</message>
+  <message key="new.simple.hint">perform simple single-criteria searches</message>
+  <message key="new.simple.label">New Simple Query</message>
+	<!-- query paging -->
+  <message key="paging.page.hint">the page to start from</message>
+  <message key="paging.page.label">Page</message>
+  <message key="paging.size.hint">how many hits per page</message>
+  <message key="paging.size.label">Hits</message>
+  <message key="paging.total.hint">how many hits this query gave last time it was used</message>
+  <message key="paging.total.label">Results</message>
+	<!-- bool field -->
+  <message key="query.bool.hint">the way your criteria match</message>
+  <message key="query.bool.label">Search Criteria</message>
+  <!-- name field -->
+  <message key="query.name.hint">the name this query will have in the history</message>
+  <message key="query.name.label">Query Name</message>
+	<!-- these keys are bound to values in the SimpleLuceneQuery -->
+  <message key="search..bool">that match</message>
+  <message key="search.and.bool">that match all of</message>
+  <message key="search.or.bool">that match some of</message>
+	<!-- titles -->
+  <message key="search.advanced.title">Advanced Query</message>
+  <message key="search.edit.title">Edit this Query</message>
+  <message key="search.favourites.title">Favourites</message>
+  <message key="search.history.title">History</message>
+  <message key="search.new.title">New Query</message>
+  <message key="search.page.title">Query Bean</message>
+  <message key="search.query.title">Query</message>
+  <message key="search.section.title">Documents</message>
+  <message key="search.simple.title">Simple Query</message>
+  <message key="search.subject.title">Documents</message>
+	<!-- these keys are bound to values in the SimpleLuceneCriterion -->
+  <message key="search.all.match">contains all words in</message>
+  <message key="search.any.match">contains any word in</message>
+  <message key="search.like.match">is somthing like</message>
+  <message key="search.not.match">does not contain</message>
+  <message key="search.phrase.match">contains the phrase</message>
+	<!-- labels -->
+  <message key="search.criteria.label">these criteria</message>
+  <message key="search.criterion.label">this criterion</message>
+  <message key="search.next.label">next</message>
+  <message key="search.pagecount.label">Number of pages</message>
+  <message key="search.pagenumber.label">Page</message>
+  <message key="search.pagesize.label">Hits per page</message>
+  <message key="search.previous.label">previous</message>
+  <message key="search.rank.label">Rank</message>
+  <message key="search.recordcount.label">Total hits</message>
+  <message key="search.score.label">Score</message>
+  <message key="search.title.label">Title</message>
+  <message key="search.uri.label">URI</message>
+	<!-- hints -->
+  <message key="search.edit.hint">you can edit this Query or save it for future use</message>
+  <message key="search.favourites.hint">view and edit your favourite queries</message>
+  <message key="search.history.hint">view your search history</message>
+  <message key="search.new.hint">create a new query of the same type as this one</message>
+	<!-- notes -->
+  <message key="search.norecords.note">no results from your search, please try again</message>
+  <message key="simple.page.note">Enter some words and hit submit.</message>
+  <message key="simple.page.title">A simple query</message>
+	<message key="required.note">* required</message>
+	<!-- errors -->
+  <message key="search.error.noquery">there was no query</message>
+  <message key="search.error.nohistory">you have no history at the moment</message>
+  <message key="search.error.noindex">You need to make a Lucene Index first (click <a href="../document-files.xsp">here</a> to make one)</message>
+	<!-- submit button -->
+  <message key="submit.hint">save changes and search</message>
+  <message key="submit.label">Submit</message>
+	
+</catalogue>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/results.xml
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/results.xml	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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: results.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+<page
+	xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+	>
+	<title><i18n:text i18n:catalogue="local">${result.query.type}.page.title</i18n:text>: ${result.query.name}</title>
+	<content>
+		<!-- description of the query -->
+		<p class="query.description">
+			<i18n:text i18n:catalogue="local">search.subject.title</i18n:text>
+			<span class="query.bool" title="local:query.bool.hint" i18n:attr="title">
+				<i18n:text i18n:catalogue="local">search.${result.query.bool}.bool</i18n:text>
+			</span>
+			<span class="query.criteria">
+				<jx:choose>
+					<jx:when test="${result.query.criteria.size() == 1}">
+						<i18n:text i18n:catalogue="local">search.criterion.label</i18n:text>:
+					</jx:when>
+					<jx:otherwise>
+						<i18n:text i18n:catalogue="local">search.criteria.label</i18n:text>:
+					</jx:otherwise>
+				</jx:choose>
+			</span>
+			<ul class="query.criteria">
+				<jx:forEach var="item" items="${result.query.criteria}">
+					<li>
+						<span class="query.criterion-field" title="local:criterion.field.hint" i18n:attr="title">
+							<i18n:text i18n:catalogue="local">search.${item.field}.field</i18n:text>
+						</span>
+						<span class="query.criterion-match" title="local:criterion.match.hint" i18n:attr="title">
+							<i18n:text i18n:catalogue="local">search.${item.match}.match</i18n:text>
+						</span>
+						<span class="query.criterion-value" title="local:criterion.value.hint" i18n:attr="title">“${item.value}”.</span>
+					</li>
+				</jx:forEach>
+			</ul>
+		</p>
+		<!-- links -->
+		<p class="links">
+			<a href="${result.query.type}.html?id=${result.id}" title="local:search.edit.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">search.edit.title</i18n:text></a>
+			<span> | </span>
+			<a href="history.html" title="local:search.history.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">search.history.title</i18n:text></a>
+			<span> | </span>
+			<a href="simple.html" title="local:new.simple.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">new.simple.label</i18n:text></a>
+			<span> | </span>
+			<a href="advanced.html" title="local:new.advanced.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">new.advanced.label</i18n:text></a>
+			<span> | </span>
+			<a href="../query/" title="local:link.home.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">link.home.label</i18n:text></a>
+		</p>
+		<!-- paging -->
+		<title><i18n:text i18n:catalogue="local">search.section.title</i18n:text></title>
+		<jx:choose>
+			<jx:when test="#{count(result/results) > 0}">
+				<jx:if test="#{count(result/nav/index) > 1}">
+					<div class="query.paging">
+						<p>
+							<span class="query.pagenumber"><i18n:text i18n:catalogue="local">search.pagenumber.label</i18n:text>: #{format-number(result/nav/page+1,'#')}.</span>
+							<span class="query.pagecount"><i18n:text i18n:catalogue="local">search.pagecount.label</i18n:text>: #{result/nav/pages}.</span>
+							<span class="query.hitcount"><i18n:text i18n:catalogue="local">search.recordcount.label</i18n:text>: #{result/nav/total}.</span>
+							<span class="query.pagesize"><i18n:text i18n:catalogue="local">search.pagesize.label</i18n:text>: #{result/nav/size}.</span>
+						</p>
+						<p class="query.navigation">
+							<jx:if test="#{result/nav/prev}">
+								<span class="query.prev">
+									<a href="${result.query.type}.html?page=#{result/nav/prev}&amp;id=${result.id}"><i18n:text i18n:catalogue="local">search.previous.label</i18n:text></a>&#160;
+								</span>
+							</jx:if>
+							<jx:if test="#{result/nav/firstIndex != 0}"><span class="query.prev-dots"> ... </span></jx:if>
+							<jx:set var="THIS" value="#{result/nav/page}"/>
+							<jx:forEach items="#{result/nav/index}">
+								<jx:choose>
+									<jx:when test="#{$THIS != .}"><span class="query.page-link"> <a href="${result.query.type}.html?page=#{.}&amp;id=${result.id}">#{format-number(.+1,'#')}</a> </span></jx:when>
+									<jx:otherwise><span class="query.this-page"> #{format-number(.+1,'#')} </span></jx:otherwise>
+								</jx:choose>
+							</jx:forEach>
+							<jx:if test="#{result/nav/lastIndex &lt; result/nav/pages - 1}"><span class="query.next-dots"> ... </span></jx:if>
+							<jx:if test="#{result/nav/next}">
+								<span class="query.next">
+									<a href="${result.query.type}.html?page=#{result/nav/next}&amp;id=${result.id}"><i18n:text i18n:catalogue="local">search.next.label</i18n:text></a>
+								</span>
+							</jx:if>
+						</p>
+					</div>
+				</jx:if>
+				<!-- results -->
+				<table class="query.results" summary="search results">
+					<tr>
+						<th align="left"><i18n:text i18n:catalogue="local">search.rank.label</i18n:text></th>
+						<th align="left"><i18n:text i18n:catalogue="local">search.score.label</i18n:text></th>
+						<th align="left"><i18n:text i18n:catalogue="local">search.title.label</i18n:text></th>
+					</tr>
+					<jx:forEach var="item" items="#{result/results}">
+						<jx:set var="score" value="${item[Packages.org.apache.cocoon.bean.query.SimpleLuceneQueryBean.SCORE_FIELD]}"/>
+						<jx:set var="index" value="${item[Packages.org.apache.cocoon.bean.query.SimpleLuceneQueryBean.INDEX_FIELD]}"/>
+						<jx:set var="url" value="${item[Packages.org.apache.cocoon.components.search.LuceneXMLIndexer.URL_FIELD]}"/>
+						<tr>
+							<td class="query.result-rank">#{format-number($index +1,'#')}</td>
+							<td class="query.result-score">#{format-number($score,'##%')}</td>
+							<td class="query.result-title"><a href="/docs/#{substring-before($url,'.xml')}.html"><jx:if test="#{string(title) = ''}"><span class="query.result-url">#{url}</span></jx:if>#{title}</a></td>
+						</tr>
+					</jx:forEach>
+				</table>
+			</jx:when>
+			<!-- no results -->
+			<jx:otherwise>
+				<p class="query.results-none"><i18n:text i18n:catalogue="local">search.norecords.note</i18n:text></p>
+			</jx:otherwise>
+		</jx:choose>
+	</content>
+</page>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/simple-binding.xml
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/simple-binding.xml	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!-- The CForms Binding for editing a simple query -->
+<!-- $Id: simple-binding.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" path="/">
+	
+  <fb:value id="name" path="name"/>
+  <fb:value id="type" path="type"/>
+  <fb:value id="bool" path="bool"/>
+
+  <fb:value id="size" path="size"/>
+  <fb:value id="page" path="page"/>
+  <fb:value id="total" path="total"/>
+
+  <fb:value id="value" path="criteria[1]/value"/>
+  <fb:value id="field" path="criteria[1]/field"/>
+  <fb:value id="match" path="criteria[1]/match"/>
+
+
+</fb:context>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/simple-fields.xml
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/simple-fields.xml	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!-- The field selectionlist for the CForms Model for editing a simple query -->
+<!-- $Id: simple-fields.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+
+<!-- 
+	Edit this list to suit the way your content is indexed.
+	
+	Make an fd:item for each field you want the user to be able to search
+	The @value represents the name of the Lucene Index field.
+	
+	The special value of "any" is reserved to mean "any field".
+-->
+
+<fd:selection-list
+	xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" 
+	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+>
+	<fd:item value="any">
+		<fd:label><i18n:text i18n:catalogue="local">field.any.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="title">
+		<fd:label><i18n:text i18n:catalogue="local">field.title.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="question">
+		<fd:label><i18n:text i18n:catalogue="local">field.question.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="person@name">
+		<fd:label><i18n:text i18n:catalogue="local">field.person@name.label</i18n:text></fd:label>
+	</fd:item>
+</fd:selection-list>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/simple-model.xml
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/simple-model.xml	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!-- The CForms Model for editing a simple query -->
+<!-- $Id: simple-model.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+
+  <fd:widgets>
+
+    <fd:messages id="messages">
+      <fd:label><i18n:text i18n:catalogue="local">message.label</i18n:text></fd:label>
+    </fd:messages>
+
+		<fd:output id="id">
+			<fd:datatype base="string"/>
+		</fd:output>
+
+		<fd:field id="name" required="true">
+			<fd:label><i18n:text i18n:catalogue="local">query.name.label</i18n:text>: </fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">query.name.hint</i18n:text></fd:hint>
+			<fd:datatype base="string"/>
+		</fd:field>
+
+		<fd:output id="type">
+			<fd:datatype base="string"/>
+		</fd:output>
+
+		<fd:output id="bool">
+			<fd:datatype base="string"/>
+		</fd:output>
+
+		<fd:field id="size" required="true">
+			<fd:label><i18n:text i18n:catalogue="local">paging.size.label</i18n:text>: </fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">paging.size.hint</i18n:text></fd:hint>
+			<fd:datatype base="long"/>
+			<fd:selection-list>
+				<fd:item value="10"/>
+				<fd:item value="20"/>
+				<fd:item value="30"/>
+				<fd:item value="40"/>
+				<fd:item value="50"/>
+			</fd:selection-list>
+		</fd:field>
+
+		<fd:output id="page">
+			<fd:label><i18n:text i18n:catalogue="local">paging.page.label</i18n:text>: </fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">paging.page.hint</i18n:text></fd:hint>
+			<fd:datatype base="long"/>
+		</fd:output>
+
+		<fd:output id="total">
+			<fd:label><i18n:text i18n:catalogue="local">paging.total.label</i18n:text>: </fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">paging.total.hint</i18n:text></fd:hint>
+			<fd:datatype base="long"/>
+		</fd:output>
+
+		<fd:submit id="cancel" action-command="cancel" validate="false">
+			<fd:label><i18n:text i18n:catalogue="local">cancel.label</i18n:text></fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">cancel.hint</i18n:text></fd:hint>
+		</fd:submit> 
+
+		<fd:submit id="submit" action-command="submit" validate="true">
+			<fd:label><i18n:text i18n:catalogue="local">submit.label</i18n:text></fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">submit.hint</i18n:text></fd:hint>
+		</fd:submit> 
+        
+		<fd:field id="value" required="true">
+			<fd:label><i18n:text i18n:catalogue="local">criterion.value.label</i18n:text>: </fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">criterion.value.hint</i18n:text></fd:hint>
+			<fd:datatype base="string"/>
+		</fd:field>
+		
+		<fd:field id="field" required="true">
+			<fd:label><i18n:text i18n:catalogue="local">criterion.field.label</i18n:text>: </fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">criterion.field.hint</i18n:text></fd:hint>
+			<fd:datatype base="string">
+				<fd:validation>
+					<fd:length min="2" max="64"/>
+				</fd:validation>
+			</fd:datatype>
+			<fd:selection-list src="screens/simple-fields.xml"/>
+		</fd:field>
+
+		<fd:output id="match">
+			<fd:label><i18n:text i18n:catalogue="local">criterion.match.label</i18n:text>: </fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">criterion.match.hint</i18n:text></fd:hint>
+			<fd:datatype base="string"/>
+		</fd:output>
+	
+  </fd:widgets>
+</fd:form>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/simple-template.xml
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/screens/simple-template.xml	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+
+<!-- The CForms Template for editing Query Beans -->
+<!-- $Id: simple-template.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+<page 
+	xmlns:ft="http://apache.org/cocoon/forms/1.0#template" 
+	xmlns:fi="http://apache.org/cocoon/forms/1.0#instance" 
+	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+>
+	<title>
+		<i18n:text i18n:catalogue="local">search.page.title</i18n:text> : <i18n:text i18n:catalogue="local">simple.page.title</i18n:text>
+	</title>
+	<content>
+		<p><i18n:text i18n:catalogue="local">simple.page.note</i18n:text></p>
+		<ft:form-template action="" method="POST">
+			<ft:continuation-id/>
+			<p class="woody-message"><ft:widget id="messages"/></p>
+			<fi:group>
+				<fi:styling layout="columns"/>
+				<fi:hint>editor layout</fi:hint>
+				<fi:items>
+					<ft:widget id="field"/>
+					<ft:widget id="value"/>
+					<hr/>
+					<ft:widget id="name"/>
+					<ft:widget id="size"/>
+					<hr/>
+				</fi:items>
+			</fi:group>
+			<i18n:text i18n:catalogue="local">required.note</i18n:text>
+			<ft:widget id="cancel"/>
+			<ft:widget id="submit"/>
+		</ft:form-template>
+	</content>
+</page>
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/sitemap.xmap
==============================================================================
--- (empty file)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/sitemap.xmap	Mon Sep 27 05:52:44 2004
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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.
+-->
+<!-- CVS $Id: sitemap.xmap 30946 2004-07-29 20:44:21Z vgritsenko $ -->
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+<!-- =========================== Components =================================== -->
+
+	<map:components>
+		<map:transformers default="xalan">
+			<map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer">
+				<catalogues default="forms">
+					<catalogue id="local" name="messages" location="screens"/>
+					<catalogue id="forms" name="FormsMessages" location="context://samples/blocks/forms/messages"/>
+				</catalogues>
+				<cache-at-startup>true</cache-at-startup>
+			</map:transformer>
+		</map:transformers>
+		<map:pipes default="caching"/>
+	</map:components>
+
+<!-- =========================== FlowScripts =================================== -->
+
+	<map:flow language="javascript">
+		<map:script src="query.js"/>
+	</map:flow>
+
+<!-- =========================== Views =================================== -->
+
+<map:views>
+  <map:view name="content" from-label="content">
+   <map:serialize type="xml"/>
+  </map:view>
+
+  <map:view from-label="content" name="pretty-content">
+   <map:transform src="context://stylesheets/system/xml2html.xslt"/>
+   <map:serialize type="html"/>
+  </map:view>
+
+  <map:view name="links" from-position="last">
+   <map:serialize type="links"/>
+  </map:view>
+
+</map:views>
+
+<!-- =========================== Pipelines ================================= -->
+
+<map:pipelines>
+
+		<map:pipeline internal-only="true">
+		
+			<map:act type="locale">
+			
+				<!-- displays the forms -->
+				<map:match pattern="form/*">
+					<map:generate type="jx" src="screens/{1}-template.xml"/>
+					<map:transform type="forms">
+						<map:parameter name="locale" value="{../locale}"/>  
+					</map:transform>
+					<map:transform type="i18n">
+						<map:parameter name="locale" value="{../locale}"/>  
+					</map:transform>
+					<map:transform src="context://samples/blocks/forms/resources/forms-samples-styling.xsl"/>
+					<map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl">
+						<map:parameter name="contextPath" value="{request:contextPath}"/>
+					</map:transform>
+					<map:serialize/>
+				</map:match>
+	
+				<!-- displays the screens -->
+				<map:match pattern="screen/*">
+					<map:generate type="jx" src="screens/{1}.xml"/>
+					<map:transform type="i18n">
+						<map:parameter name="locale" value="{../locale}"/>  
+					</map:transform>
+					<map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl">
+						<map:parameter name="contextPath" value="{request:contextPath}"/>
+					</map:transform>
+					<map:serialize/>
+				</map:match>
+				
+			</map:act>
+
+		</map:pipeline>
+  
+		<map:pipeline>
+
+			<!--					
+			 Used for CForms Continuations
+			
+			 must be placed before external page pipelines
+			 and after internal screen pipelines
+			 otherwise you get infinite loops					 
+			-->				
+			<map:match type="request-parameter" pattern="continuation-id">
+				<map:call continuation="{1}"/>
+			</map:match>
+
+			<!-- home page -->
+    	<map:match pattern="">
+    		<map:redirect-to uri="cocoon:/screen/index"/>
+      </map:match>
+
+			<!-- history page -->
+			<map:match pattern="history.html">
+				<map:call function="history">
+					<map:parameter name="screen" value="screen/history"/> 									<!-- the history screen cocoon:/ pipeline -->
+				</map:call>
+			</map:match>
+
+			<!-- searches -->
+			<map:match pattern="*.html">
+				<map:call function="simpleLuceneQuery">
+					<map:parameter name="form-definition" value="screens/{1}-model.xml"/> 	<!-- the editing form definition file -->
+					<map:parameter name="bindingURI" value="screens/{1}-binding.xml"/> 			<!-- the editing form binding file -->
+					<map:parameter name="form" value="form/{1}"/> 													<!-- the editing form cocoon:/ pipeline -->
+					<map:parameter name="type" value="{1}"/> 																<!-- the query type -->
+					<map:parameter name="lucene-directory" value="index2"/> 								<!-- the lucene index -->
+					<map:parameter name="screen" value="screen/results"/> 									<!-- the search results cocoon:/ pipeline -->
+					<map:parameter name="id" value="{request-param:id}"/> 									<!-- the history id param -->
+					<map:parameter name="page" value="{request-param:page}"/> 							<!-- the page param -->
+					<map:parameter name="query" value="{request-param:query}"/> 						<!-- the query param (for quick queries) -->
+					<map:parameter name="match" value="{request-param:match}"/> 						<!-- the match param (for quick queries) -->
+					<map:parameter name="field" value="{request-param:field}"/> 						<!-- the field param (for quick queries) -->
+				</map:call>
+			</map:match>
+
+			<!-- used in the docs, to show files -->
+			<map:match pattern="**.xml">
+				<map:generate src="{1}.xml"/>
+				<map:serialize type="xml"/>
+			</map:match>
+
+		</map:pipeline>
+	</map:pipelines>
+
+</map:sitemap>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/search-index.xsp
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/search-index.xsp	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/search-index.xsp	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id$ -->
 <xsp:page language="java"
           xmlns:xsp="http://apache.org/xsp"
           xmlns:xsp-request="http://apache.org/xsp/request/2.0">

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/sitemap.xmap
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/sitemap.xmap	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/sitemap.xmap	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id$ -->
 <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
 
 <!-- =========================== Components ================================ -->
@@ -60,6 +60,12 @@
 <map:pipelines>
   
   <map:pipeline>
+  	
+		<!-- mount query bean pipelines -->
+		<map:match pattern="query/**">
+			<map:mount check-reload="yes" src="query/sitemap.xmap" uri-prefix="query"/>
+		</map:match>
+
     <map:match pattern="images/*.gif">
       <map:read src="images/{1}.gif" mime-type="image/gif">
         <map:parameter name="expires" value="60000"/>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/statistic-index.xsp
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/statistic-index.xsp	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/statistic-index.xsp	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id$ -->
 <xsp:page language="java" xmlns:xsp="http://apache.org/xsp">
 
   <xsp:structure>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/all-files2content.xsl
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/all-files2content.xsl	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/all-files2content.xsl	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id$ -->
 <xsl:stylesheet
   version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -41,4 +41,4 @@
 
   <xsl:template match="@*|node()" priority="-1"></xsl:template>
   <xsl:template match="text()" priority="-1"></xsl:template>
-</xsl:stylesheet> 
\ No newline at end of file
+</xsl:stylesheet> 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/content2lucene.xsl
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/content2lucene.xsl	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/content2lucene.xsl	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id$ -->
 <xsl:stylesheet
   version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -36,10 +36,27 @@
   <xsl:template match="file">
     <lucene:document>
       <xsl:attribute name="url"><xsl:value-of select="name"/></xsl:attribute>
-      <xsl:copy-of select="include/*"/>
+      <xsl:apply-templates select="include/*"/>
     </lucene:document>
   </xsl:template>
 
-  <xsl:template match="@*|node()" priority="-1"></xsl:template>
-  <xsl:template match="text()" priority="-1"></xsl:template>
-</xsl:stylesheet> 
\ No newline at end of file
+	<!-- store main titles -->
+	<xsl:template match="page/title|header/title">
+		<title lucene:store="true"><xsl:apply-templates/></title>
+	</xsl:template>
+	
+	<xsl:template match="faqs[@title]|book[@title]">
+		<xsl:copy>
+			<xsl:apply-templates select="@*[local-name() != 'title']"/>
+			<title lucene:store="true"><xsl:value-of select="@title"/></title>
+			<xsl:apply-templates/>
+		</xsl:copy>
+	</xsl:template>
+	
+	<xsl:template match="path"></xsl:template>
+	
+  <xsl:template match="@*|node()" priority="-2"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
+  <xsl:template match="text()" priority="-1"><xsl:value-of select="."/></xsl:template>
+  
+  
+</xsl:stylesheet> 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/lucene-index2html.xsl
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/lucene-index2html.xsl	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/lucene-index2html.xsl	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id$ -->
 <xsl:stylesheet
   version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -61,4 +61,4 @@
 
   <xsl:template match="@*|node()" priority="-1"></xsl:template>
   <xsl:template match="text()" priority="-1"></xsl:template>
-</xsl:stylesheet> 
\ No newline at end of file
+</xsl:stylesheet> 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/search-index2html.xsl
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/search-index2html.xsl	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/search-index2html.xsl	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id$ -->
 <xsl:stylesheet
   version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
@@ -151,6 +151,7 @@
           <xsl:value-of select="@uri"/>
         </a>
       </td>
+      <td><xsl:value-of select="search:field[@name='title']"/></td>
     </tr>
   </xsl:template>
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/search2html.xsl
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/search2html.xsl	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/stylesheets/search2html.xsl	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id$ -->
 <xsl:stylesheet
   version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/welcome-index.xsp
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/welcome-index.xsp	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/welcome-index.xsp	Mon Sep 27 05:52:44 2004
@@ -14,7 +14,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-
+<!-- CVS $Id$ -->
 <xsp:page language="java" xmlns:xsp="http://apache.org/xsp">
 
   <page>
@@ -92,6 +92,15 @@
       <p>
         Enter a query and search the Lucene index2 that you have created
         - using <a href="findIt2?queryString=cocoon">Cocoon Generators</a>.
+      </p>
+      <p>
+        Construct a query and search the Lucene index2 that you have created
+        - using <a href="query/advanced.html">Cocoon Forms</a>.<br/>
+        Or enter a word or two in here : 
+        	<form action="query/simple.html">
+        		<input type="text" name="query" size="20" value="cocoon"/>
+        		<input type="submit" value="Search" />
+        	</form>
       </p>
       
       <h2>Internals</h2>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/midi/java/org/apache/cocoon/generation/XMidiGenerator.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/midi/java/org/apache/cocoon/generation/XMidiGenerator.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/midi/java/org/apache/cocoon/generation/XMidiGenerator.java	Mon Sep 27 05:52:44 2004
@@ -139,27 +139,14 @@
     public void generate()
         throws IOException, SAXException, ProcessingException {
         try {
-            if (this.getLogger().isDebugEnabled()) {
-                this.getLogger().debug("processing file " + super.source);
-                this.getLogger().debug(
-                    "file resolved to " + this.inputSource.getURI());
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Source " + super.source +
+                                  " resolved to " + this.inputSource.getURI());
             }
-            parseMIDI(this.inputSource, super.xmlConsumer);
 
+            parseMIDI(this.inputSource);
         } catch (SAXException e) {
-            final Exception cause = e.getException();
-            if (cause != null) {
-                if (cause instanceof ProcessingException)
-                    throw (ProcessingException) cause;
-                if (cause instanceof IOException)
-                    throw (IOException) cause;
-                if (cause instanceof SAXException)
-                    throw (SAXException) cause;
-                throw new ProcessingException(
-                    "Could not read resource " + this.inputSource.getURI(),
-                    cause);
-            }
-            throw e;
+            SourceUtil.handleSAXException(this.inputSource.getURI(), e);
         }
     }
 
@@ -175,14 +162,9 @@
 
     /**
      * @param source
-     * @param consumer
      */
-    private void parseMIDI(Source source, XMLConsumer consumer)
-        throws
-            SAXException,
-            SourceNotFoundException,
-            IOException,
-            ProcessingException {
+    private void parseMIDI(Source source)
+    throws SAXException, SourceNotFoundException, IOException, ProcessingException {
         InputStream inputStream = source.getInputStream();
 
         AttributesImpl attr = new AttributesImpl();
@@ -664,7 +646,7 @@
     }
 
     /**
-    add track data to DOM structure
+     * Add track data to DOM structure
     */
     void doTrack(byte[] dta, int len)
         throws SAXException, ProcessingException {
@@ -1036,9 +1018,8 @@
     }
 
     /**
-    write formatted hex data to file
-    */
-
+     * Write formatted hex data to file
+     */
     void doHexData(byte[] dta, int len)
         throws ProcessingException, SAXException {
         AttributesImpl attr = new AttributesImpl();
@@ -1064,5 +1045,4 @@
 
         this.contentHandler.endElement("", "HEXDATA", "HEXDATA");
     }
-
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/repository/SourceRepositoryImpl.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/repository/SourceRepositoryImpl.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/repository/SourceRepositoryImpl.java	Mon Sep 27 05:52:44 2004
@@ -34,7 +34,7 @@
 /**
  * SourceRepository implementation.
  * 
- * @version $Id: SourceRepositoryImpl.java,v 1.6 2004/03/27 22:01:22 unico Exp $
+ * @version $Id$
  */
 public class SourceRepositoryImpl extends AbstractLogEnabled 
 implements Serviceable, ThreadSafe, SourceRepository {
@@ -368,7 +368,7 @@
                     Iterator children = origin.getChildren().iterator();
                     while (children.hasNext()) {
                         TraversableSource child = (TraversableSource) children.next();
-                        int status = copy(child,target.getChild(child.getName()),recurse);
+                        /*int status =*/ copy(child,target.getChild(child.getName()),recurse);
                         // TODO: record this status
                         // according to the spec we must continue moving files even though
                         // a part of the move has not succeeded

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/impl/RepositorySourceFactory.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/impl/RepositorySourceFactory.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/components/source/impl/RepositorySourceFactory.java	Mon Sep 27 05:52:44 2004
@@ -61,9 +61,9 @@
                 throw new IOException("Resolver service is not available: " + e.toString());
             }
         }
-        if (m_manager.hasService(SourceDescriptorManager.ROLE)) {
+        if (m_manager.hasService(SourceDescriptor.ROLE)) {
             try {
-                m_descriptor = (SourceDescriptor) m_manager.lookup(SourceDescriptorManager.ROLE);
+                m_descriptor = (SourceDescriptor) m_manager.lookup(SourceDescriptor.ROLE);
             }
             catch (ServiceException e) {
                 // impossible

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/transformation/SourcePropsWritingTransformer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/transformation/SourcePropsWritingTransformer.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/repository/java/org/apache/cocoon/transformation/SourcePropsWritingTransformer.java	Mon Sep 27 05:52:44 2004
@@ -79,7 +79,7 @@
      * Set the namespace
      */
     public SourcePropsWritingTransformer() {
-        this.defaultNamespaceURI = SPWT_URI;
+        super.defaultNamespaceURI = SPWT_URI;
     }
 
     public void recycle() {

Mime
View raw message