You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by je...@apache.org on 2004/11/18 17:25:29 UTC

svn commit: r76248 - in cocoon/trunk/src/blocks/querybean: . conf java java/org java/org/apache java/org/apache/cocoon java/org/apache/cocoon/bean java/org/apache/cocoon/bean/query samples samples/flow samples/forms samples/i18n samples/screens samples/stylesheets

Author: jeremy
Date: Thu Nov 18 08:25:28 2004
New Revision: 76248

Added:
   cocoon/trunk/src/blocks/querybean/
   cocoon/trunk/src/blocks/querybean/conf/
   cocoon/trunk/src/blocks/querybean/conf/querybean.xsamples
   cocoon/trunk/src/blocks/querybean/java/
   cocoon/trunk/src/blocks/querybean/java/org/
   cocoon/trunk/src/blocks/querybean/java/org/apache/
   cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/
   cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/
   cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/
   cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/ContextAccess.java
   cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterion.java
   cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterionBean.java
   cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQuery.java
   cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQueryBean.java
   cocoon/trunk/src/blocks/querybean/samples/
   cocoon/trunk/src/blocks/querybean/samples/flow/
   cocoon/trunk/src/blocks/querybean/samples/flow/QueryFavourites.js
   cocoon/trunk/src/blocks/querybean/samples/flow/QueryHistory.js
   cocoon/trunk/src/blocks/querybean/samples/flow/QuerySearcher.js
   cocoon/trunk/src/blocks/querybean/samples/flow/indexer.js
   cocoon/trunk/src/blocks/querybean/samples/flow/pager.js
   cocoon/trunk/src/blocks/querybean/samples/flow/query.js
   cocoon/trunk/src/blocks/querybean/samples/forms/
   cocoon/trunk/src/blocks/querybean/samples/forms/advanced-binding.xml
   cocoon/trunk/src/blocks/querybean/samples/forms/advanced-fields.xml
   cocoon/trunk/src/blocks/querybean/samples/forms/advanced-model.xml
   cocoon/trunk/src/blocks/querybean/samples/forms/advanced-template.xml
   cocoon/trunk/src/blocks/querybean/samples/forms/simple-binding.xml
   cocoon/trunk/src/blocks/querybean/samples/forms/simple-fields.xml
   cocoon/trunk/src/blocks/querybean/samples/forms/simple-model.xml
   cocoon/trunk/src/blocks/querybean/samples/forms/simple-template.xml
   cocoon/trunk/src/blocks/querybean/samples/i18n/
   cocoon/trunk/src/blocks/querybean/samples/i18n/messages_en.xml
   cocoon/trunk/src/blocks/querybean/samples/screens/
   cocoon/trunk/src/blocks/querybean/samples/screens/cancelled.xml
   cocoon/trunk/src/blocks/querybean/samples/screens/error.xml
   cocoon/trunk/src/blocks/querybean/samples/screens/history.xml
   cocoon/trunk/src/blocks/querybean/samples/screens/index.xml
   cocoon/trunk/src/blocks/querybean/samples/screens/lucene-indexer.xml
   cocoon/trunk/src/blocks/querybean/samples/screens/results.xml
   cocoon/trunk/src/blocks/querybean/samples/sitemap.xmap
   cocoon/trunk/src/blocks/querybean/samples/stylesheets/
   cocoon/trunk/src/blocks/querybean/samples/stylesheets/content2lucene.xsl
   cocoon/trunk/src/blocks/querybean/samples/stylesheets/lucene2simple-page.xsl
Log:
adding querybean block

Added: cocoon/trunk/src/blocks/querybean/conf/querybean.xsamples
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/conf/querybean.xsamples	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,25 @@
+<?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.
+-->
+<!-- CVS $Id: lucene.xsamples,v 1.5 2004/07/11 19:47:56 antonio Exp $ -->
+<xsamples xpath="/samples" unless="group[@name='QueryBean']">
+
+  <group name="QueryBean">
+    <sample name="Query Bean" href="querybean/welcome">
+      Examples showing the use of Apache Lucene with CForms to search.
+    </sample>
+  </group>
+</xsamples>

Added: cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/ContextAccess.java
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/ContextAccess.java	Thu Nov 18 08:25:28 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/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterion.java
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterion.java	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,104 @@
+/*
+  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.analysis.Analyzer;
+import org.apache.lucene.search.Query;
+
+
+
+/**
+ * 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,v 1.1 2004/10/22 12:14:22 jeremy Exp $
+ */
+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/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterionBean.java
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterionBean.java	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,266 @@
+/*
+  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,v 1.1 2004/10/22 12:14:22 jeremy Exp $
+ */
+public class SimpleLuceneCriterionBean implements SimpleLuceneCriterion, Cloneable {
+
+	/**
+	 * 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 mTerm;
+	
+	/**
+	 * Default constructor.
+	 */
+	public SimpleLuceneCriterionBean() {
+	}
+
+
+	/**
+	 * Utility constructor.
+	 *
+	 * @param match the kind of match to use
+	 * @param field the field to search
+	 * @param term the terms to search for
+	 */
+	public SimpleLuceneCriterionBean(String field, String match, String term) {
+		mField = field;
+		mMatch = match;
+		mTerm = term;
+	}
+
+	public Object clone() throws CloneNotSupportedException {
+		SimpleLuceneCriterionBean criterion = (SimpleLuceneCriterionBean)super.clone();
+		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 (mTerm));
+    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 term
+	 *
+	 * @return the <code>String</code> term of the Bean. 
+	 */
+	public String getTerm() {
+		return mTerm;
+	}
+	
+	/**
+	 * Sets the Bean's term.<br/>
+	 * ie. the string of search terms for this <code>Criterion</code>.
+	 *
+	 * @param term the <code>String</code> term of the Bean. 
+	 */
+	public void setTerm(String term) {
+		mTerm = term;
+	}
+
+}

Added: cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQuery.java
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQuery.java	Thu Nov 18 08:25:28 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,v 1.1 2004/10/22 12:14:22 jeremy Exp $
+ */
+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/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQueryBean.java
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQueryBean.java	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,432 @@
+/*
+  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,v 1.1 2004/10/22 12:14:22 jeremy Exp $
+ */
+public class SimpleLuceneQueryBean implements SimpleLuceneQuery, Cloneable {
+
+	/**
+	 * The DEFAULT_PAGE_SIZE of this bean.
+	 * ie. <code>20</code>
+	 */
+	public static Long DEFAULT_PAGE_SIZE = new Long (20);
+
+	/**
+	 * The DEFAULT_PAGE of this bean.
+	 * ie. <code>0</code>
+	 */
+	public static Long DEFAULT_PAGE = new Long (0);
+
+	/**
+	 * 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;
+
+	/**
+	 * The Bean's owner.
+	 */
+	private String mUser;
+
+	/**
+	 * 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 = DEFAULT_PAGE;
+		mTotal = null;
+		mUser = null;
+		mId = null;
+		this.addCriterion (new SimpleLuceneCriterionBean (field, match, query));
+	}
+	
+	public Object clone() throws CloneNotSupportedException {
+		SimpleLuceneQueryBean query = (SimpleLuceneQueryBean)super.clone();
+		query.setCriteria(new ArrayList(mCriteria.size()));
+		Iterator i = this.getCriteria().iterator ();
+		while (i.hasNext()) query.addCriterion((SimpleLuceneCriterionBean)((SimpleLuceneCriterionBean)i.next()).clone ());
+		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 ());
+		}
+		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 = getPage().intValue () * getSize().intValue ();
+		if (start > mTotal.intValue ()) start = mTotal.intValue (); 
+		int end = start + getSize().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 owner.
+	 *
+	 * @return the <code>String</code> owner of the Bean. 
+	 */
+	public String getUser() {
+		return mUser;
+	}
+	
+	/**
+	 * Sets the Bean's owner.
+	 *
+	 * @param user the <code>String</code> owner of the Bean. 
+	 */
+	public void setUser(String user) {
+		mUser = user;
+	}
+	
+	/**
+	 * Gets the Bean's page size
+	 *
+	 * @return the <code>Long</code> page size of the Bean. 
+	 */
+	public Long getSize() {
+		if (mSize == null) {
+			return DEFAULT_PAGE_SIZE;
+		} else {
+			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() {
+		if (mPage == null) {
+			return DEFAULT_PAGE;
+		} else {
+			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);
+	}
+	
+}

Added: cocoon/trunk/src/blocks/querybean/samples/flow/QueryFavourites.js
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/flow/QueryFavourites.js	Thu Nov 18 08:25:28 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.
+*/
+
+
+// QueryFavourites constructor
+function QueryFavourites(user) {
+	this._user = user;
+	// to be implemented using Apache OJB
+}
+
+// add a Query to the QueryFavourites
+QueryFavourites.prototype.add = function(query) {
+	// to be implemented using Apache OJB
+}
+
+// remove a Query from the QueryFavourites
+QueryFavourites.prototype.remove = function(id) {
+	// to be implemented using Apache OJB
+}
+
+// get a Query from the QueryFavourites using it's ID
+QueryFavourites.prototype.get = function(id) {
+	// to be implemented using Apache OJB
+	throw("error.no.favourite");
+}
+
+// get a list of Queries from the QueryFavourites
+QueryFavourites.prototype.list = function() {
+	// to be implemented using Apache OJB
+	return new java.util.ArrayList(1);	
+}
+
+// close the QueryFavourites
+QueryFavourites.prototype.close = function() {
+	// to be implemented using Apache OJB
+}

Added: cocoon/trunk/src/blocks/querybean/samples/flow/QueryHistory.js
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/flow/QueryHistory.js	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,88 @@
+/*
+  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.
+*/
+
+importClass(Packages.java.util.ArrayList);
+importClass(Packages.java.lang.Long);
+
+
+// QueryHistory Object Constructor
+function QueryHistory(attr) {
+	try {
+		this._history = cocoon.session.getAttribute(attr);
+		if (this._history == null) {
+			this._history = new ArrayList();
+			cocoon.session.setAttribute(attr, this._history);
+		}
+	} catch (error) {
+		cocoon.log.error(error);
+	}
+}
+
+// add a Query to the QueryHistory
+QueryHistory.prototype.add = function(item) {
+	this._history.add(item);
+}
+
+// empty the QueryHistory
+QueryHistory.prototype.clear = function() {
+	this._history.clear();
+}
+
+// remove a Query from the QueryHistory
+QueryHistory.prototype.remove = function(item) {
+	this._history.remove(item);
+}
+
+// return a list of the Queries in the QueryHistory, in reverse order
+QueryHistory.prototype.list = function() {
+	var count = this._history.size();
+	var history = new ArrayList(count);
+	var index = 0;
+	for (var position = 0; position < count; position++) {
+		index = count - position - 1; // reverse the order
+		history.add(position, {id: new Long(index), query: this._history.get(index)});
+	}
+	return history;
+}
+
+// get a Query from the QueryHistory, using it's ID, always returns a copy
+QueryHistory.prototype.get = function(id) {
+	var clone, item;
+	try {
+		item = this._history.get(parseInt(id));
+	} catch (e1) {
+		cocoon.log.error(e1);
+		throw("error.no.history");
+	}
+	try {
+		clone = item.clone();
+	} catch (e2) {
+		cocoon.log.error(e2);
+		throw("items stored in history need to be Cloneable");
+	}
+	return clone;
+}
+
+// move a Query to the top of the QueryHistory list
+QueryHistory.prototype.promote = function(query) {
+	this._history.remove(query);
+	this._history.add(query);
+}
+
+// get the size of the QueryHistory list
+QueryHistory.prototype.size = function() {
+	return this._history.size();
+}

Added: cocoon/trunk/src/blocks/querybean/samples/flow/QuerySearcher.js
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/flow/QuerySearcher.js	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,121 @@
+/*
+  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.
+*/
+
+importClass(Packages.org.apache.cocoon.components.search.LuceneCocoonSearcher);
+importClass(Packages.org.apache.cocoon.components.search.LuceneCocoonHelper);
+importClass(Packages.org.apache.cocoon.Constants);
+importPackage(Packages.org.apache.cocoon.bean.query);
+
+cocoon.load("flow/pager.js");
+
+// QuerySearcher constructor
+function QuerySearcher(directory, analyzer) {
+	var contextAccess;
+	this._low = SimpleLuceneQueryBean.DEFAULT_PAGE_SIZE / 2;
+	this._high = SimpleLuceneQueryBean.DEFAULT_PAGE_SIZE * 5;
+	try {
+		contextAccess = cocoon.createObject(ContextAccess);
+		var index = new java.io.File(directory);
+		if (!index.isAbsolute()) {
+			var workDir = contextAccess.getAvalonContext().get(Constants.CONTEXT_WORK_DIR);
+			index = new java.io.File(workDir, directory);
+		}
+		if (!index.exists()) throw ("search.error.noindex");
+		this._searcher = cocoon.getComponent(LuceneCocoonSearcher.ROLE);
+		this._searcher.setDirectory(LuceneCocoonHelper.getDirectory(index, false));
+		if (this._searcher.getAnalyzer() == null) {
+			this._searcher.setAnalyzer(LuceneCocoonHelper.getAnalyzer(analyzer));
+		}
+	} catch (error) {
+		cocoon.log.error(error);
+		throw (error);
+	} finally {
+		cocoon.disposeObject(contextAccess);		
+	}
+}
+
+// cleanup
+QuerySearcher.prototype.close = function() {
+	cocoon.releaseComponent(this._searcher);
+}
+
+// perform a search using a Query
+QuerySearcher.prototype.search = function(query, history) {
+	if (query != null) {
+		var results = query.search(this._searcher);
+		history.add(query);
+		var historyid = new java.lang.Long(history.size() -1);
+		var nav = pagerNavigation(query.total, query.page, query.size);
+		return { results: results, nav: nav, query: query, id: historyid, tip: this.getTip(query) };
+	} else {
+		throw("search.error.nohistory");
+	}
+}
+
+// perform a page using a Query
+QuerySearcher.prototype.page = function(page, id, history) {
+	var p;
+	var query = history.get(id);
+	if (query != null) {
+		try {
+			p = new java.lang.Long(page);
+		} catch (error) {
+			p = SimpleLuceneQueryBean.DEFAULT_PAGE;
+		}
+		query.setPage(p);
+		var results = query.search(this._searcher);
+		//history.promote(query); // this was causing addition to history while paging (why?), did not want this ......
+		var historyid = new java.lang.Long(history.size() -1);
+		var nav = pagerNavigation(query.total, query.page, query.size);
+		return { results: results, nav: nav, query: query, id: historyid };
+	} else {
+		throw("search.error.nohistory");
+	}
+}
+
+// perform a quick search using params
+QuerySearcher.prototype.quicksearch = function(type, bool, match, field, value, size, history) {
+	var s;
+	if ("".equals(match) || match == undefined) match = SimpleLuceneCriterion.ANY_MATCH;
+	if ("".equals(field) || field == undefined) field = SimpleLuceneCriterion.ANY_FIELD;
+	if ("".equals(bool) || bool == undefined) bool = null;
+	try {
+		s = new java.lang.Long(size);
+	} catch (error) {
+		s = SimpleLuceneQueryBean.DEFAULT_PAGE_SIZE;
+	}
+	var query = new SimpleLuceneQueryBean(type, bool, match, field, value);
+	query.setSize(s);
+	return this.search(query, history);
+}
+
+// make a new query
+QuerySearcher.prototype.newquery = function(type, bool, match, field) {
+	if ("".equals(match) || match == undefined) match = SimpleLuceneCriterion.ANY_MATCH;
+	if ("".equals(field) || field == undefined) field = SimpleLuceneCriterion.ANY_FIELD;
+	if ("".equals(bool) || bool == undefined) bool = SimpleLuceneQueryBean.OR_BOOL;
+	return new SimpleLuceneQueryBean(type, bool, match, field, "");
+}
+
+
+
+
+QuerySearcher.prototype.getTip = function(query) {
+	return null;
+}
+
+
+

Added: cocoon/trunk/src/blocks/querybean/samples/flow/indexer.js
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/flow/indexer.js	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,118 @@
+/*
+  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.
+*/
+
+importClass(Packages.org.apache.excalibur.source.SourceResolver);
+importClass(Packages.java.net.URL);
+importClass(Packages.java.io.File);
+importClass(Packages.java.util.ArrayList);
+
+
+
+// flowscripts for indexing content for the Query Bean
+// $Id: query.js,v 1.3 2004/10/22 12:14:23 jeremy Exp $
+
+function createIndex () {
+	var cdir = cocoon.parameters["content-directory"]
+	var rdir = cocoon.parameters["result-directory"];
+	var include = cocoon.parameters["include-pattern"];
+	var exclude = cocoon.parameters["exclude-pattern"];
+	var rsuffix = cocoon.parameters["result-suffix"];
+	var files = new ArrayList();
+	try {
+		var inRegExp = "undefined".equals(include) ? new RegExp(".*") : new RegExp(include);
+		var exRegExp = "undefined".equals(exclude) ? null : new RegExp(exclude);
+		var base = new File(new URL(resolve(cdir).getURI()).getFile());
+		if (base.isDirectory()) {
+			getFiles(base, files, inRegExp, exRegExp);
+		} else {
+			throw("error.invalid.content");
+		}
+		cocoon.sendPage(cocoon.parameters["screen"], 
+			{
+				directory: cocoon.parameters["lucene-directory"],
+				analyzer: cocoon.parameters["lucene-analyzer"],
+				merge: cocoon.parameters["lucene-merge-factor"],
+				create: cocoon.parameters["lucene-create-index"],
+				files: files,
+				converter: new Converter(base, rdir, rsuffix),
+				content: cocoon.parameters["lucene-content"]
+			}
+		);
+	} catch (error) {
+		cocoon.log.error(error);
+		cocoon.sendPage("screen/error", {message: error});	
+	}
+}
+
+/**
+ * Utility function - resolve a URI to a Source
+ *
+ */
+function resolve(uri) {
+   try {
+      var resolver = cocoon.getComponent(SourceResolver.ROLE);
+      return resolver.resolveURI(uri);
+    } catch (error) {
+      cocoon.log.error("Unable to resolve source", error);
+      throw (error);
+    } finally {
+      cocoon.releaseComponent(resolver);
+   } 
+}
+
+function getFiles(dir, files, inRegExp, exRegExp) {
+	try {
+		var theFiles = dir.listFiles();
+		for (var i = 0; i < theFiles.length; i++ ) {
+			var f = theFiles[i];
+			if (f.isDirectory()) {
+				getFiles(f, files, inRegExp, exRegExp);
+			} else if (f.isFile()) {
+				if (f.canRead()) {
+					var apath = f.getAbsolutePath();
+					if (inRegExp.test(apath)) {
+						if (exRegExp == null || !exRegExp.test(apath)) {
+							files.add(apath);
+						}						
+					}
+				}
+			}
+		}
+	} catch (error) {
+		cocoon.log.error(error);
+	}
+}
+
+function Converter (base, rdir, rsuffix) {
+	this._base = base.getAbsolutePath();
+	this._rdir = rdir;
+	this._rsuffix = rsuffix;
+	if ("undefined".equals(this._rdir)) this._rdir = "";
+	if ("undefined".equals(this._rsuffix)) this._rsuffix = "";
+}
+
+Converter.prototype.convert = function(file) {
+	var path = file.toString();
+	// remove the absolute base path
+	path = path.substring(this._base.length() +1);
+	// replace the suffix, if a replacement was provided
+	if (!"".equals(this._rsuffix)) path = path.substring(0, path.lastIndexOf(".")) + this._rsuffix;
+	// prefix with the results path
+	path = this._rdir + path;
+	// replace windows path delimiters with http ones
+	path = path.replace( '\\', '/' );
+	return path;
+}
\ No newline at end of file

Added: cocoon/trunk/src/blocks/querybean/samples/flow/pager.js
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/flow/pager.js	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,50 @@
+// flowscripts util for paging navigation
+// $Id: pager.js,v 1.4 2004/07/05 14:40:31 savs Exp $
+
+
+
+/*
+	Utility function to create a 'paging record' for the display of long paged lists of records 
+*/
+
+function pagerNavigation(total, page, size) {
+	total = parseInt(total); // make sure JS realises they are Numbers, so we can add them without getting string concatenation !!!
+	page = parseInt(page);
+	size = parseInt(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 + 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) {}
+	var record = { 
+			total: new java.lang.Integer( total), 
+			next: total > ((page * size) + size) ? new java.lang.Integer(page + 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
+		};
+	return record;
+}

Added: cocoon/trunk/src/blocks/querybean/samples/flow/query.js
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/flow/query.js	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,146 @@
+/*
+  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,v 1.3 2004/10/22 12:14:23 jeremy Exp $
+
+cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
+cocoon.load("flow/QuerySearcher.js");
+cocoon.load("flow/QueryHistory.js");
+cocoon.load("flow/QueryFavourites.js");
+
+// display the User's Search History
+function showHistory() {
+	var history = new QueryHistory(cocoon.parameters["history"]);
+	cocoon.sendPage(cocoon.parameters["screen"], {queries: history.list()});
+}
+
+// erase the User's Search History
+function clearHistory() {
+	var history = new QueryHistory(cocoon.parameters["history"]);
+	history.clear();
+	cocoon.sendPage(cocoon.parameters["screen"]);
+}
+
+// display the User's Favourite Searches
+/*function showFavourites() {
+	var favourites = null;
+	try {
+		favourites = new QueryFavourites(cocoon.parameters["user-id"]);
+		cocoon.sendPage(cocoon.parameters["screen"], {queries: favourites.list()});
+	} catch (error) {
+		cocoon.log.error(error);
+		cocoon.sendPage("screen/error", {message: error});
+	} finally {
+		if (favourites != null) favourites.close();
+	}
+}*/
+
+
+// add a history item to the User's Favourite Searches
+/*function addFavourite() {
+	var history = new QueryHistory(cocoon.parameters["history"]);
+	var favourites = null;
+	try {
+		favourites = new QueryFavourites(cocoon.parameters["user-id"]);
+		var query = history.get(cocoon.parameters["hid"]);
+		if (query != null) {
+			favourites.add(query);
+		}
+		cocoon.sendPage(cocoon.parameters["screen"], {queries: favourites.list()});
+	} catch (error) {
+		cocoon.log.error(error);
+		cocoon.sendPage("screen/error", {message: error});
+	} finally {
+		if (favourites != null) favourites.close();
+	}
+}*/
+
+// add an item from the User's Favourite Searches, using it's ID
+/*function removeFavourite() {
+	var favourites = null;
+	try {
+		favourites = new QueryFavourites(cocoon.parameters["user-id"]);
+		favourites.remove(cocoon.parameters["fid"]);
+		cocoon.sendPage(cocoon.parameters["screen"], {queries: favourites.list()});
+	} catch (error) {
+		cocoon.log.error(error);
+		cocoon.sendPage("screen/error", {message: error});
+	} finally {
+		if (favourites != null) favourites.close();
+	}
+}*/
+
+// perform searches
+function doSearch() {
+	var screen = cocoon.parameters["screen"];
+	var searcher = null;
+	var favourites = null;
+	var history = new QueryHistory(cocoon.parameters["history"]);
+	try {
+		searcher = new QuerySearcher(cocoon.parameters["lucene-directory"], cocoon.parameters["lucene-analyzer"]);
+		favourites = new QueryFavourites();
+		var result = null;
+		if (!"".equals(cocoon.parameters["page"])) { 					// paging an existing Query
+			result = searcher.page(cocoon.parameters["page"], cocoon.parameters["hid"], history);
+		} else if (!"".equals(cocoon.parameters["query"])) { 	// running a quick Query
+			result = searcher.quicksearch(cocoon.parameters["type"], cocoon.parameters["bool"], cocoon.parameters["match"], cocoon.parameters["field"], cocoon.parameters["query"], cocoon.parameters["size"], history);
+		} else if (!"".equals(cocoon.parameters["fid"])) { 		// running a favourite Query
+			result = searcher.search(favourites.get(cocoon.parameters["fid"]), history);
+		} else if ("".equals(cocoon.parameters["hid"])) { 			// making a new Query to edit
+			var query = searcher.newquery(cocoon.parameters["type"], cocoon.parameters["bool"], cocoon.parameters["match"], cocoon.parameters["field"]);
+			if (edit(query)) {
+				result = searcher.search(query, history);
+			} else {
+				cocoon.sendPage("screen/cancelled", {message: "cancel.note"});
+				return;				
+			}
+		} else { 																							// editing a Query from history
+			var query = history.get(cocoon.parameters["hid"]);
+			if (edit(query)) {
+				result = searcher.search(query, history);
+			} else {
+				cocoon.sendPage("screen/cancelled", {message: "cancel.note"});
+				return;	
+			}
+		}
+		cocoon.sendPage(screen, {result: result});
+	} catch (error) {
+		cocoon.log.error(error);
+		cocoon.sendPage("screen/error", {message: error});	
+	} finally {
+		if (searcher != null) searcher.close();
+		if (favourites != null) favourites.close();
+	}
+}
+
+
+// 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);
+		cocoon.log.debug("form submitted");
+		query.id = null; // this is no longer a favourite, now it has been edited
+		return true;
+	} else {
+		cocoon.log.debug("form cancelled");
+		return false;
+	}
+}

Added: cocoon/trunk/src/blocks/querybean/samples/forms/advanced-binding.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/forms/advanced-binding.xml	Thu Nov 18 08:25:28 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="term" id="term"/></fb:identity>
+
+		<fb:on-bind>
+			<fb:value id="term" path="term"/>
+			<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/trunk/src/blocks/querybean/samples/forms/advanced-fields.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/forms/advanced-fields.xml	Thu Nov 18 08:25:28 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/trunk/src/blocks/querybean/samples/forms/advanced-model.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/forms/advanced-model.xml	Thu Nov 18 08:25:28 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="term" required="true">
+          <fd:label><i18n:text i18n:catalogue="local">criterion.term.label</i18n:text>: </fd:label>
+          <fd:hint><i18n:text i18n:catalogue="local">criterion.term.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="forms/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/trunk/src/blocks/querybean/samples/forms/advanced-template.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/forms/advanced-template.xml	Thu Nov 18 08:25:28 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="term"/>
+								<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/trunk/src/blocks/querybean/samples/forms/simple-binding.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/forms/simple-binding.xml	Thu Nov 18 08:25:28 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="term" path="criteria[1]/term"/>
+  <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/trunk/src/blocks/querybean/samples/forms/simple-fields.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/forms/simple-fields.xml	Thu Nov 18 08:25:28 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/trunk/src/blocks/querybean/samples/forms/simple-model.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/forms/simple-model.xml	Thu Nov 18 08:25:28 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="term" required="true">
+			<fd:label><i18n:text i18n:catalogue="local">criterion.term.label</i18n:text>: </fd:label>
+			<fd:hint><i18n:text i18n:catalogue="local">criterion.term.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="forms/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/trunk/src/blocks/querybean/samples/forms/simple-template.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/forms/simple-template.xml	Thu Nov 18 08:25:28 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="term"/>
+					<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/trunk/src/blocks/querybean/samples/i18n/messages_en.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/i18n/messages_en.xml	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,160 @@
+<?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 54581 2004-10-11 13:30:17Z jeremy $ -->
+<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.term.hint">the word or words you are searching for</message>
+  <message key="criterion.term.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>
+  <message key="history.cleared.note">Your query history has been cleared.</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.clearhistory.title">Clear 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>
+	<message key="cancel.note">you cancelled your edit</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="create.html">here</a> to make one)</message>
+  <message key="error.invalid.content">The content you wanted indexed did not exist, this sample indexes 'docs/xdocs', please ensure you have built Cocoon's documentation.</message>
+  
+	<!-- submit button -->
+  <message key="submit.hint">save changes and search</message>
+  <message key="submit.label">Submit</message>
+	
+</catalogue>

Added: cocoon/trunk/src/blocks/querybean/samples/screens/cancelled.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/screens/cancelled.xml	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,23 @@
+<?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.
+-->
+<page xmlns:t="http://apache.org/cocoon/templates/jx/1.0"
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+	<title>Cancelled</title>
+	<content>
+		<p><i18n:text i18n:catalogue="local">#{message}</i18n:text></p>
+	</content>
+</page>

Added: cocoon/trunk/src/blocks/querybean/samples/screens/error.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/screens/error.xml	Thu Nov 18 08:25:28 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/trunk/src/blocks/querybean/samples/screens/history.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/screens/history.xml	Thu Nov 18 08:25:28 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.size()!=0}">
+				<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?hid=${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?hid=${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/trunk/src/blocks/querybean/samples/screens/index.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/screens/index.xml	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,103 @@
+<?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="create.html">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>
+		
+		<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="forms/simple-fields.xml?cocoon-view=pretty-content">forms/simple-fields.xml</a>, while the <code>advanced</code> search form uses the file <a href="forms/advanced-fields.xml?cocoon-view=pretty-content">forms/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="i18n/messages_en.xml?cocoon-view=pretty-content">i18n/messages_en.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="forms/advanced-model.xml?cocoon-view=pretty-content">Model</a>, <a href="forms/advanced-binding.xml?cocoon-view=pretty-content">Binding</a> and <a href="forms/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/trunk/src/blocks/querybean/samples/screens/lucene-indexer.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/screens/lucene-indexer.xml	Thu Nov 18 08:25:28 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.
+-->
+
+<!-- $Id: results.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+<lucene:index
+	xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+  xmlns:cinclude="http://apache.org/cocoon/include/1.0"
+  xmlns:lucene="http://apache.org/cocoon/lucene/1.0"   
+	analyzer="${analyzer}" 
+	directory="${directory}" 
+	create="${create}" 
+	merge-factor="${merge}"
+>
+	<jx:forEach var="entry" items="${files}">
+    <lucene:document url="${converter.convert(entry)}">
+      <cinclude:includexml ignoreErrors="true">
+        <cinclude:src>${content}${entry}</cinclude:src>
+      </cinclude:includexml>
+    </lucene:document>
+	</jx:forEach>
+</lucene:index>
\ No newline at end of file

Added: cocoon/trunk/src/blocks/querybean/samples/screens/results.xml
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/screens/results.xml	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,130 @@
+<?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.term}”.</span>
+					</li>
+				</jx:forEach>
+			</ul>
+		</p>
+		<jx:if test="${result.tip != null}">
+			<i18n:text i18n:catalogue="local">${result.tip}</i18n:text>
+		</jx:if>
+		<!-- links -->
+		<p class="links">
+			<a href="${result.query.type}.html?hid=${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="welcome" 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;hid=${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;hid=${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;hid=${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="#{$url}"><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/trunk/src/blocks/querybean/samples/sitemap.xmap
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/sitemap.xmap	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,249 @@
+<?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 56371 2004-11-02 13:17:20Z cziegeler $ -->
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+<!-- =========================== Components =================================== -->
+
+	<map:components>
+		<map:transformers default="xslt">
+			<map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer">
+				<catalogues default="forms">
+					<catalogue id="local" name="messages" location="i18n"/>
+					<catalogue id="forms" name="FormsMessages" location="context://samples/blocks/forms/messages"/>
+				</catalogues>
+				<cache-at-startup>true</cache-at-startup>
+			</map:transformer>
+     <map:transformer name="lucene-indexer" src="org.apache.cocoon.transformation.LuceneIndexTransformer"/>
+		</map:transformers>
+		<map:pipes default="caching"/>
+	</map:components>
+
+<!-- =========================== FlowScripts =================================== -->
+
+	<map:flow language="javascript">
+		<map:script src="flow/query.js"/>
+		<map:script src="flow/indexer.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:component-configurations>
+			<global-variables>
+				<history>_query_bean_history_</history><!-- the name of the Session Attribute, used to store History -->
+				<lucene-analyzer>org.apache.lucene.analysis.standard.StandardAnalyzer</lucene-analyzer><!-- the name of the Lucene Analyzer to use -->	
+				<!--+
+						|		The path to the Lucene Index to use. 
+						|
+						| 	If you supply an absolute path, this will be used as-is
+						| 	If you supply a non-absolute path, this will be used inside the 
+						|		servlet's work-directory. If stored here, it will be destroyed on shutdown.
+						|
+						+-->
+				<lucene-directory>cocoon-docs</lucene-directory>
+			</global-variables>
+		</map:component-configurations>
+
+		<map:pipeline internal-only="true">
+		
+			<map:act type="locale">
+			
+				<!-- displays the forms -->
+				<map:match pattern="form/*">
+					<map:generate type="jx" src="forms/{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>
+
+				<!-- prepare the document for indexing -->
+				<map:match pattern="prepare4indexing/**">
+					<map:generate src="{1}"/>
+					<map:transform src="stylesheets/content2lucene.xsl"/>
+					<map:serialize type="xml"/>
+				</map:match>
+
+				<!-- the lucene indexer -->
+				<map:match pattern="screen/indexer">
+					<map:generate type="jx" src="screens/lucene-indexer.xml"/>
+					<map:transform type="cinclude"/>
+					<map:transform type="lucene-indexer"/>
+					<map:transform src="stylesheets/lucene2simple-page.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 rest of 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>
+    	<map:match pattern="welcome">
+    		<map:redirect-to uri="cocoon:/screen/index"/>
+      </map:match>
+
+
+			<!-- create the index -->
+			<map:match pattern="create.html">
+				<map:call function="createIndex">
+					<map:parameter name="screen" value="screen/indexer"/>
+					<map:parameter name="lucene-directory" value="{global:lucene-directory}"/>
+					<map:parameter name="lucene-analyzer" value="{global:lucene-analyzer}"/>
+					<map:parameter name="lucene-merge-factor" value="10"/>
+					<map:parameter name="lucene-create-index" value="false"/>
+					<map:parameter name="lucene-content" value="cocoon:/prepare4indexing/"/>
+					<map:parameter name="content-directory" value="context://docs/xdocs"/>
+					<map:parameter name="include-pattern" value="\.xml$"/>
+					<map:parameter name="exclude-pattern" value="/book\.xml$"/>
+					<map:parameter name="result-directory" value="/docs/"/>
+					<map:parameter name="result-suffix" value=".html"/>
+				</map:call>
+			</map:match>
+
+			<!-- list history -->
+			<map:match pattern="history.html">
+				<map:call function="showHistory">
+					<map:parameter name="screen" value="screen/history"/>
+					<map:parameter name="history" value="{global:history}"/>
+				</map:call>
+			</map:match>
+			
+			<!-- clear history -->
+			<map:match pattern="clear-history.html">
+				<map:call function="clearHistory">
+					<map:parameter name="screen" value="screen/clear-history"/>
+					<map:parameter name="history" value="{global:history}"/>
+				</map:call>
+			</map:match>
+
+			<!-- list favourites
+			<map:match pattern="favourites.html">
+				<map:call function="showFavourites">
+					<map:parameter name="screen" value="screen/favourites"/>
+					<map:parameter name="user-id" value="{session-context:authentication/authentication/ID}"/>
+				</map:call>
+			</map:match> -->
+
+			<!-- add a history item to the favourites, using the history ID
+			<map:match pattern="add-favourite.html">
+				<map:call function="addFavourite">
+					<map:parameter name="screen" value="screen/favourites"/>
+					<map:parameter name="user-id" value="{session-context:authentication/authentication/ID}"/>
+					<map:parameter name="hid" value="{request-param:hid}"/>
+					<map:parameter name="history" value="{global:history}"/>
+				</map:call>
+			</map:match> -->
+
+			<!-- remove an item from the favourites, using the favourite ID
+			<map:match pattern="remove-favourite.html">
+				<map:call function="removeFavourite">
+					<map:parameter name="screen" value="screen/favourites"/>
+					<map:parameter name="user-id" value="{session-context:authentication/authentication/ID}"/>
+					<map:parameter name="fid" value="{request-param:fid}"/>
+				</map:call>
+			</map:match> -->
+
+			<!-- do the searches -->
+			<map:match pattern="*.html">
+				<map:call function="doSearch">
+					<map:parameter name="form" value="form/{1}"/>
+					<map:parameter name="form-definition" value="forms/{1}-model.xml"/>
+					<map:parameter name="bindingURI" value="forms/{1}-binding.xml"/>
+					<map:parameter name="lucene-directory" value="{global:lucene-directory}"/>
+					<map:parameter name="lucene-analyzer" value="{global:lucene-analyzer}"/>
+					<map:parameter name="screen" value="screen/results"/>
+					<map:parameter name="history" value="{global:history}"/>
+					<map:parameter name="type" value="{1}"/>
+					<map:parameter name="hid" value="{request-param:hid}"/>
+					<map:parameter name="fid" value="{request-param:fid}"/>
+					<map:parameter name="page" value="{request-param:page}"/>
+					<map:parameter name="query" value="{request-param:query}"/>
+					<map:parameter name="match" value="{request-param:match}"/>
+					<map:parameter name="field" value="{request-param:field}"/>
+					<map:parameter name="size" value="{request-param:size}"/>
+					<map:parameter name="bool" value="{request-param:bool}"/>
+				</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>

Added: cocoon/trunk/src/blocks/querybean/samples/stylesheets/content2lucene.xsl
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/stylesheets/content2lucene.xsl	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,41 @@
+<?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.
+-->
+<!-- CVS $Id: content2lucene.xsl 36225 2004-08-11 14:36:46Z vgritsenko $ -->
+<xsl:stylesheet
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:lucene="http://apache.org/cocoon/lucene/1.0" 
+>
+	<!-- store 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="@*|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:template match="comment()"></xsl:template>
+  
+  
+</xsl:stylesheet> 
\ No newline at end of file

Added: cocoon/trunk/src/blocks/querybean/samples/stylesheets/lucene2simple-page.xsl
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/querybean/samples/stylesheets/lucene2simple-page.xsl	Thu Nov 18 08:25:28 2004
@@ -0,0 +1,57 @@
+<?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.
+-->
+<!-- CVS $Id: content2lucene.xsl 36225 2004-08-11 14:36:46Z vgritsenko $ -->
+<xsl:stylesheet
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:lucene="http://apache.org/cocoon/lucene/1.0" 
+>
+  <xsl:template match="lucene:index">
+    <page>
+      <title>Lucene Index</title>
+      <content>
+        <p>
+          <small>
+            <a href="welcome">Welcome</a>
+          </small>
+        </p>
+        <ul>
+          <li>merge-factor - <xsl:value-of select="@merge-factor"/></li>
+          <li>create - <xsl:value-of select="@create"/></li>
+          <li>directory - <xsl:value-of select="@directory"/></li>
+          <li>analyzer - <xsl:value-of select="@analyzer"/></li>
+        </ul>
+
+        <table>
+          <tr><th>url</th><th>elapsed-time</th></tr>
+          <xsl:apply-templates/>
+        </table>
+      </content>
+    </page>
+  </xsl:template>
+
+  <xsl:template match="lucene:document">
+    <tr>
+      <td><xsl:value-of select="@url"/></td>
+      <td><xsl:value-of select="@elapsed-time"/></td>
+    </tr>
+  </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