cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jer...@apache.org
Subject svn commit: r157073 [1/2] - in cocoon/branches/BRANCH_2_1_X: ./ src/blocks/databases/conf/ src/blocks/lucene/java/org/apache/cocoon/bean/ src/blocks/lucene/samples/ src/blocks/lucene/samples/query/ src/blocks/ojb/conf/ src/blocks/querybean/ src/blocks/querybean/WEB-INF/ src/blocks/querybean/WEB-INF/xconf/ src/blocks/querybean/conf/ src/blocks/querybean/java/ src/blocks/querybean/java/org/ src/blocks/querybean/java/org/apache/ src/blocks/querybean/java/org/apache/cocoon/ src/blocks/querybean/java/org/apache/cocoon/bean/ src/blocks/querybean/java/org/apache/cocoon/bean/query/ src/blocks/querybean/samples/ src/blocks/querybean/samples/flow/ src/blocks/querybean/samples/forms/ src/blocks/querybean/samples/i18n/ src/blocks/querybean/samples/resources/ src/blocks/querybean/samples/resources/images/ src/blocks/querybean/samples/screens/ src/blocks/querybean/samples/stylesheets/
Date Fri, 11 Mar 2005 12:52:25 GMT
Author: jeremy
Date: Fri Mar 11 04:52:08 2005
New Revision: 157073

URL: http://svn.apache.org/viewcvs?view=rev&rev=157073
Log:
sync querybean block between 2.1.7-dev and 2.2.0

Added:
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/WEB-INF/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/WEB-INF/xconf/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/WEB-INF/xconf/cocoon-querybean.xconf
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/conf/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/conf/querybean.xsamples
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/ContextAccess.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterion.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterionBean.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQuery.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQueryBean.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QueryFavourites.js
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QueryHistory.js
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QuerySearcher.js
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/indexer.js
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/pager.js
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/query.js
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-binding.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-fields.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-model.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-template.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/simple-binding.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/simple-fields.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/simple-model.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/simple-template.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/i18n/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/i18n/messages_en.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/i18n/messages_es.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/resources/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/resources/images/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/resources/images/fave.jpg   (with props)
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/screens/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/screens/cancelled.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/screens/error.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/screens/favourites.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/screens/history.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/screens/index.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/screens/lucene-indexer.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/screens/results.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/sitemap.xmap
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/stylesheets/
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/stylesheets/content2lucene.xsl
    cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/stylesheets/lucene2simple-page.xsl
Removed:
    cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/java/org/apache/cocoon/bean/
    cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/query/
Modified:
    cocoon/branches/BRANCH_2_1_X/gump.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/databases/conf/cocoondb.script
    cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/sitemap.xmap
    cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/repository_user.xml

Modified: cocoon/branches/BRANCH_2_1_X/gump.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/gump.xml?view=diff&r1=157072&r2=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/gump.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/gump.xml Fri Mar 11 04:52:08 2005
@@ -1047,6 +1047,28 @@
     <nag from="Gump &lt;general@gump.apache.org&gt;" to="dev@cocoon.apache.org"/>
   </project>
 
+  <project name="cocoon-block-querybean" status="unstable" dir="src/blocks/querybean">
+    <package>org.apache.cocoon</package>
+
+    <ant target="gump-block">
+      <property name="block-name" value="querybean"/>
+      <property name="version" value="@@DATE@@"/>
+    </ant>
+
+    <depend project="cocoon" inherit="all"/>
+    <depend project="cocoon-block-forms" type="samples"/>
+    <depend project="cocoon-block-lucene"/>
+    <depend project="cocoon-block-ojb"/>
+    <depend project="jakarta-lucene"/>
+
+    <work nested="tools/anttasks"/>
+    <home nested="build/cocoon-@@DATE@@"/>
+
+    <jar name="blocks/querybean-block.jar"/>
+
+    <nag from="Gump &lt;general@gump.apache.org&gt;" to="dev@cocoon.apache.org"/>
+  </project>
+
   <project name="cocoon-block-slop" status="unstable" dir="src/blocks/slop">
     <package>org.apache.cocoon</package>
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/conf/cocoondb.script
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/databases/conf/cocoondb.script?view=diff&r1=157072&r2=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/databases/conf/cocoondb.script (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/databases/conf/cocoondb.script Fri Mar 11 04:52:08 2005
@@ -20,6 +20,9 @@
 CREATE TABLE STATE_TAX(CATEGORY VARCHAR NOT NULL,GROSSTAX_COLLECTED DOUBLE NOT NULL,NETTAX_COLLECTED DOUBLE NOT NULL,YEAR INTEGER NOT NULL)
 CREATE TABLE MEDIA(ID INTEGER IDENTITY PRIMARY KEY,IMAGE BINARY,MIMETYPE VARCHAR)
 CREATE TABLE SOURCEPROPS(SOURCE VARCHAR NOT NULL,NAMESPACE VARCHAR NOT NULL,NAME VARCHAR NOT NULL,VALUE VARCHAR NOT NULL,CONSTRAINT SYS_CT_11 UNIQUE(SOURCE,NAMESPACE,NAME))
+CREATE TABLE OJB_HL_SEQ(TABLENAME VARCHAR(175) NOT NULL,FIELDNAME VARCHAR(70) NOT NULL,MAX_KEY BIGINT,GRAB_SIZE INTEGER,VERSION INTEGER,CONSTRAINT SYS_PK_OJB_HL_SEQ PRIMARY KEY(TABLENAME,FIELDNAME))
+CREATE TABLE QUERY(ID BIGINT IDENTITY PRIMARY KEY,USER_ID VARCHAR NOT NULL,Q_DATE TIMESTAMP,Q_BOOL VARCHAR,Q_NAME VARCHAR,Q_TYPE VARCHAR,Q_SIZE BIGINT,UNIQUE(ID))
+CREATE TABLE CRITERION(ID BIGINT IDENTITY PRIMARY KEY,Q_ID BIGINT,C_FIELD VARCHAR,C_MATCH VARCHAR,C_TERM VARCHAR,CONSTRAINT SYS_FK_20 FOREIGN KEY(Q_ID) REFERENCES QUERY(ID),UNIQUE(ID))
 GRANT ALL ON CLASS "org.hsqldb.Library" TO PUBLIC
 GRANT ALL ON CLASS "java.lang.Math" TO PUBLIC
 CREATE USER SA PASSWORD "" ADMIN
@@ -137,3 +140,5 @@
 INSERT INTO STATE_TAX VALUES('Horse Racing',1.7921198E7,1.7321198E7,2001)
 INSERT INTO STATE_TAX VALUES('Severance',7981539.0,7967438.0,2001)
 INSERT INTO STATE_TAX VALUES('School District Income',1.61257059E8,1.53238001E8,2001)
+INSERT INTO QUERY VALUES(1,'anon','1970-01-01 01:00:00.0',NULL,'test','simple',20)
+INSERT INTO CRITERION VALUES(1,1,'any','any','cocoon')

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/sitemap.xmap?view=diff&r1=157072&r2=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/sitemap.xmap (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/lucene/samples/sitemap.xmap Fri Mar 11 04:52:08 2005
@@ -64,12 +64,6 @@
 <map:pipelines>
   
   <map:pipeline>
-  	
-    <!-- mount query bean pipelines
-      <map:match pattern="query/**">
-        <map:mount check-reload="yes" src="query/sitemap.xmap" uri-prefix="query"/>
-      </map:match> 
-    -->
 
     <map:match pattern="images/*.gif">
       <map:read src="images/{1}.gif" mime-type="image/gif">

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/repository_user.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/repository_user.xml?view=diff&r1=157072&r2=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/repository_user.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/ojb/conf/repository_user.xml Fri Mar 11 04:52:08 2005
@@ -30,4 +30,31 @@
         <field-descriptor name="name"           column="NAME"           jdbc-type="VARCHAR"/>
     </class-descriptor>
 
+    <!-- mappings for the QueryBean Block -->
+    <class-descriptor class="org.apache.cocoon.bean.query.SimpleLuceneCriterionBean" table="CRITERION">
+        <field-descriptor name="id"   column="ID"   jdbc-type="BIGINT" primarykey="true" autoincrement="true"/>
+        <field-descriptor name="qid" column="Q_ID" jdbc-type="BIGINT" access="anonymous"/>
+        <field-descriptor name="field" column="C_FIELD" jdbc-type="VARCHAR"/>
+        <field-descriptor name="match" column="C_MATCH" jdbc-type="VARCHAR"/>
+        <field-descriptor name="term" column="C_TERM" jdbc-type="VARCHAR"/>
+    </class-descriptor>
+
+    <class-descriptor class="org.apache.cocoon.bean.query.SimpleLuceneQueryBean" table="QUERY">
+        <field-descriptor name="id"   column="ID"   jdbc-type="BIGINT" primarykey="true" autoincrement="true"/>
+        <field-descriptor name="user" column="USER_ID" jdbc-type="VARCHAR"/>
+        <field-descriptor name="date" column="Q_DATE" jdbc-type="TIMESTAMP" conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion"/>
+        <field-descriptor name="bool" column="Q_BOOL" jdbc-type="VARCHAR"/>
+        <field-descriptor name="name" column="Q_NAME" jdbc-type="VARCHAR"/>
+        <field-descriptor name="type" column="Q_TYPE" jdbc-type="VARCHAR"/>
+        <field-descriptor name="size" column="Q_SIZE" jdbc-type="BIGINT"/>
+        <collection-descriptor
+            name="criteria"
+            element-class-ref="org.apache.cocoon.bean.query.SimpleLuceneCriterionBean"
+            auto-retrieve="true"
+            auto-update="true"
+            auto-delete="true">
+            <inverse-foreignkey field-ref="qid"/>
+        </collection-descriptor>
+    </class-descriptor>
+
 <!-- END OF OJB USER MAPPINGS-->

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/WEB-INF/xconf/cocoon-querybean.xconf
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/WEB-INF/xconf/cocoon-querybean.xconf?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/WEB-INF/xconf/cocoon-querybean.xconf (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/WEB-INF/xconf/cocoon-querybean.xconf Fri Mar 11 04:52:08 2005
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2005 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.
+-->
+
+<!--+
+    |
+    | SVN $Id: cocoon-querybean.xconf 153527 2005-02-12 19:16:16Z cziegeler $
+    +-->
+<components>
+  <!-- Dummy config that other blocks can import -->
+</components>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/conf/querybean.xsamples
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/conf/querybean.xsamples?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/conf/querybean.xsamples (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/conf/querybean.xsamples Fri Mar 11 04:52:08 2005
@@ -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/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/ContextAccess.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/ContextAccess.java?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/ContextAccess.java (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/ContextAccess.java Fri Mar 11 04:52:08 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cocoon.bean.query;
+
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.Contextualizable;
+
+
+/**
+ * A component to help you get the Avalon Context.
+ * Probably only a temporary solution to getting this from within a FlowScript.
+ * cocoon.createObject (Packages.org.apache.cocoon.bean.query.ContextAccess);
+ *
+ * @version CVS $Id: ContextAccess.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+
+public class ContextAccess implements Contextualizable {
+
+    private Context avalonContext;
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+     */
+    public void contextualize(Context avalonContext) {
+        this.avalonContext = avalonContext;
+    }
+
+    /**
+     * Return the Avalon Context
+     * @return The context object
+     */
+    public Context getAvalonContext() {
+        return this.avalonContext;
+    }
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterion.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterion.java?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterion.java (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterion.java Fri Mar 11 04:52:08 2005
@@ -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/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterionBean.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterionBean.java?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterionBean.java (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneCriterionBean.java Fri Mar 11 04:52:08 2005
@@ -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.Serializable;
+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>
+ *
+ */
+public class SimpleLuceneCriterionBean implements SimpleLuceneCriterion, Cloneable, Serializable {
+
+	/**
+	 * The Bean's ID.
+	 */
+	protected Long id;
+
+	/**
+	 * The Bean's index field to seach in.
+	 */
+	protected String field;
+
+	/**
+	 * The Bean's match value.
+	 */
+	protected String match;
+
+	/**
+	 * The Bean's search term.
+	 */
+	protected String term;
+	
+	/**
+	 * 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) {
+		this.field = field;
+		this.match = match;
+		this.term = 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 f = this.field;
+		Query query = null;
+		if (ANY_FIELD.equals(this.field)) f = LuceneXMLIndexer.BODY_FIELD;
+		// extract Terms from the query string
+    TokenStream tokens = analyzer.tokenStream(f, new StringReader (this.term));
+    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(this.match)) {
+			if (words.size() > 1) {
+				query = new BooleanQuery();
+				for (int i = 0; i < words.size(); i++) {
+					((BooleanQuery)query).add(new TermQuery(new Term(f, (String)words.elementAt(i))), false, false);
+				}
+			} else if (words.size() == 1) {
+				query = new TermQuery(new Term(f, (String)words.elementAt(0)));
+			}
+		} 
+		
+		if (ALL_MATCH.equals(this.match)) {
+			if (words.size() > 1) {
+				query = new BooleanQuery();
+				for (int i = 0; i < words.size(); i++) {
+					((BooleanQuery)query).add(new TermQuery(new Term (f, (String)words.elementAt(i))), true, false);
+				}
+			} else if (words.size() == 1) {
+				query = new TermQuery(new Term(f, (String)words.elementAt(0)));
+			}
+		} 
+		
+		if (NOT_MATCH.equals(this.match)) {
+			if (words.size() > 1) {
+				query = new BooleanQuery();
+				for (int i = 0; i < words.size(); i++) {
+					((BooleanQuery)query).add(new TermQuery(new Term(f, (String)words.elementAt(i))), true, true);
+				}
+			} else if (words.size() == 1) {
+				query = new TermQuery(new Term(f, (String)words.elementAt(0)));
+			}
+		} 
+		
+		if (LIKE_MATCH.equals(this.match)) {
+			if (words.size() > 1) {
+				query = new BooleanQuery();
+				for (int i = 0; i < words.size(); i++) {
+					((BooleanQuery)query).add(new FuzzyQuery(new Term(f, (String)words.elementAt(i))), false, false);
+				}
+			} else if (words.size() == 1) {
+				query = new FuzzyQuery(new Term(f, (String)words.elementAt(0)));
+			}
+		}
+		
+		if (PHRASE_MATCH.equals (this.match)) {
+			if (words.size() > 1) {
+				query = new PhraseQuery();
+				((PhraseQuery)query).setSlop(0);
+				for (int i = 0; i < words.size(); i++) {
+					((PhraseQuery)query).add(new Term(f, (String)words.elementAt(i)));
+				}
+			} else if (words.size() == 1) {
+				query = new TermQuery(new Term(f, (String)words.elementAt(0)));
+			}
+		}
+		return query;
+	}
+	
+	/**
+	 * Gets the prohibited status from the Criterion
+	 */
+	public boolean isProhibited () {
+		if (NOT_MATCH.equals(this.match)) return true;
+		return false;
+	}
+	
+	
+	// Bean
+	
+	/**
+	 * Gets the Bean's ID
+	 *
+	 * @return the <code>Long</code> ID of the Bean. 
+	 */
+	public Long getId() {
+		return this.id;
+	}
+	
+	/**
+	 * Sets the Bean's ID
+	 *
+	 * @param id the <code>Long</code> ID of the Bean. 
+	 */
+	public void setId(Long id) {
+		this.id = id;
+	}
+	
+	/**
+	 * Gets the Bean's field
+	 *
+	 * @return the <code>String</code> field of the Bean. 
+	 */
+	public String getField() {
+		return this.field;
+	}
+	
+	/**
+	 * 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) {
+		this.field = field;
+	}
+	
+	/**
+	 * Gets the Bean's match
+	 *
+	 * @return the <code>String</code> match of the Bean. 
+	 */
+	public String getMatch() {
+		return this.match;
+	}
+	
+	/**
+	 * 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) {
+		this.match = match;
+	}
+	
+	/**
+	 * Gets the Bean's term
+	 *
+	 * @return the <code>String</code> term of the Bean. 
+	 */
+	public String getTerm() {
+		return this.term;
+	}
+	
+	/**
+	 * 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) {
+		this.term = term;
+	}
+
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQuery.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQuery.java?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQuery.java (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQuery.java Fri Mar 11 04:52:08 2005
@@ -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/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQueryBean.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQueryBean.java?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQueryBean.java (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/java/org/apache/cocoon/bean/query/SimpleLuceneQueryBean.java Fri Mar 11 04:52:08 2005
@@ -0,0 +1,433 @@
+/*
+  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.Serializable;
+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, Serializable {
+
+	/**
+	 * 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 date; 
+
+	/**
+	 * The Bean's list of Criteria.
+	 */
+	private List criteria;
+
+	/**
+	 * The Bean's ID.
+	 */
+	private Long id;
+
+	/**
+	 * The Bean's current page.
+	 */
+	private Long page; 
+
+	/**
+	 * The Bean's page isze.
+	 */
+	private Long size; 
+
+	/**
+	 * The Bean's hit count.
+	 */
+	private Long total; 
+
+	/**
+	 * The Bean's query boolean.
+	 */
+	private String bool;
+
+	/**
+	 * The Bean's query name.
+	 */
+	private String name;
+
+	/**
+	 * The Bean's query type.
+	 */
+	private String type;
+
+	/**
+	 * The Bean's owner.
+	 */
+	private String user;
+
+	/**
+	 * 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) {
+		this.name = "My Query";
+		this.type = type;
+		this.bool = bool;
+		this.size = DEFAULT_PAGE_SIZE;
+		this.page = DEFAULT_PAGE;
+		this.total = null;
+		this.user = null;
+		this.id = null;
+		this.addCriterion(new SimpleLuceneCriterionBean(field, match, query));
+	}
+	
+	public Object clone() throws CloneNotSupportedException {
+		SimpleLuceneQueryBean query = (SimpleLuceneQueryBean)super.clone();
+		query.setCriteria(new ArrayList(this.criteria.size()));
+		Iterator it = this.getCriteria().iterator();
+		while (it.hasNext()) query.addCriterion((SimpleLuceneCriterionBean)((SimpleLuceneCriterionBean)it.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 it = criteria.iterator();
+		boolean required = false;
+		if (AND_BOOL.equals(this.bool)) required = true;
+		while (it.hasNext()) {
+			SimpleLuceneCriterion criterion = (SimpleLuceneCriterion)it.next();
+			Query subquery = criterion.getQuery (searcher.getAnalyzer());
+			query.add(subquery, required, criterion.isProhibited());
+		}
+		Hits hits = searcher.search(query);
+		this.total = new Long (hits.length());
+		this.date = 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 > this.total.intValue()) start = this.total.intValue(); 
+		int end = start + getSize().intValue();
+		if (end > this.total.intValue()) end = this.total.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 this.id;
+	}
+	
+	/**
+	 * Sets the Bean's ID.
+	 *
+	 * @param id the <code>Long</code> ID of the Bean. 
+	 */
+	public void setId(Long id) {
+		this.id = id;
+	}
+	
+	/**
+	 * Gets the Bean's name.
+	 *
+	 * @return the <code>String</code> name of the Bean. 
+	 */
+	public String getName() {
+		return this.name;
+	}
+	
+	/**
+	 * Sets the Bean's Name.
+	 *
+	 * @param name the <code>String</code> name of the Bean. 
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * Gets the Bean's type.
+	 *
+	 * @return the <code>String</code> type of the Bean. 
+	 */
+	public String getType() {
+		return this.type;
+	}
+	
+	/**
+	 * Sets the Bean's type.
+	 *
+	 * @param type the <code>String</code> type of the Bean. 
+	 */
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	/**
+	 * Gets the Bean's boolean operator.
+	 *
+	 * @return the <code>String</code> boolean of the Bean. 
+	 */
+	public String getBool() {
+		return this.bool;
+	}
+	
+	/**
+	 * 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) {
+		this.bool = bool;
+	}
+
+	/**
+	 * Gets the Bean's owner.
+	 *
+	 * @return the <code>String</code> owner of the Bean. 
+	 */
+	public String getUser() {
+		return this.user;
+	}
+	
+	/**
+	 * Sets the Bean's owner.
+	 *
+	 * @param user the <code>String</code> owner of the Bean. 
+	 */
+	public void setUser(String user) {
+		this.user = user;
+	}
+	
+	/**
+	 * Gets the Bean's page size
+	 *
+	 * @return the <code>Long</code> page size of the Bean. 
+	 */
+	public Long getSize() {
+		if (this.size == null) {
+			return DEFAULT_PAGE_SIZE;
+		} else {
+			return this.size;
+		}
+	}
+	
+	/**
+	 * 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) {
+		this.size = size;
+	}
+	
+	/**
+	 * Gets the Bean's page index
+	 *
+	 * @return the <code>Long</code> page index of the Bean. 
+	 */
+	public Long getPage() {
+		if (this.page == null) {
+			return DEFAULT_PAGE;
+		} else {
+			return this.page;
+		}
+	}
+	
+	/**
+	 * 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) {
+		this.page = page;
+	}
+
+	/**
+	 * Gets the Bean's hit count.
+	 *
+	 * @return the <code>Long</code> hit count of the Bean. 
+	 */
+	public Long getTotal() {
+		return this.total;
+	}
+	
+	/**
+	 * Sets the Bean's hit count.
+	 *
+	 * @param total the <code>Long</code> hit count of the Bean. 
+	 */
+	public void setTotal(Long total) {
+		this.total = total;
+	}
+
+	/**
+	 * Gets the Bean's inception date.
+	 *
+	 * @return the <code>Date</code> of the Bean. 
+	 */
+	public Date getDate() {
+		return this.date;
+	}
+	
+	/**
+	 * Sets the Bean's inception date.
+	 *
+	 * @param date the <code>Date</code> inception date of the Bean. 
+	 */
+	public void setDate(Date date) {
+		this.date = date;
+	}
+
+	/**
+	 * Gets the Bean's criteria.
+	 *
+	 * @return the <code>List</code> of Bean Query criteria. 
+	 */
+	public List getCriteria() {
+		return this.criteria;
+	}
+	
+	/**
+	 * Sets the Bean's criteria.
+	 *
+	 * @param criteria the <code>List</code> of Bean Query criteria. 
+	 */
+	public void setCriteria(List criteria) {
+		this.criteria = 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 (this.criteria == null) this.criteria = new ArrayList();
+		this.criteria.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 (this.criteria != null) this.criteria.remove(criterion);
+	}
+	
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QueryFavourites.js
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QueryFavourites.js?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QueryFavourites.js (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QueryFavourites.js Fri Mar 11 04:52:08 2005
@@ -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.
+*/
+
+importClass(Packages.org.apache.ojb.broker.PersistenceBrokerFactory);
+importClass(Packages.org.apache.ojb.broker.query.Criteria);
+importClass(Packages.org.apache.ojb.broker.query.QueryByCriteria);
+importPackage(Packages.org.apache.cocoon.bean.query);
+
+
+// QueryFavourites constructor
+function QueryFavourites(user) {
+	this._user = user;
+}
+
+// add a Query to the QueryFavourites
+QueryFavourites.prototype.add = function(query) {
+	query.user = this._user;
+	query.date = new java.util.Date();
+	var broker = null;
+	try {
+		broker = PersistenceBrokerFactory.defaultPersistenceBroker();
+		broker.beginTransaction();
+		broker.store(query);
+		broker.commitTransaction();
+	} catch (e) {
+		cocoon.log.error(e);
+		if(broker != null) broker.abortTransaction();
+	} finally {
+		if (broker != null) broker.close();
+	}
+}
+
+// remove a Query from the QueryFavourites
+QueryFavourites.prototype.remove = function(id) {
+	var broker = null;
+	var result = null;
+	try {
+		broker = PersistenceBrokerFactory.defaultPersistenceBroker();
+		var criteria = criteria = new Criteria();
+		criteria.addEqualTo("id", new java.lang.Long(id));
+		//criteria.addEqualTo("user", new String(this._user));
+    var query = new QueryByCriteria(SimpleLuceneQueryBean, criteria);
+		result = broker.getObjectByQuery(query);
+		broker.beginTransaction();
+		broker["delete"](result);
+		broker.commitTransaction();
+	} catch (e) {
+		cocoon.log.error(e);
+		throw("error.no.favourite");
+	} finally {
+		if (broker != null) broker.close();
+	}
+	return result;	
+}
+
+// get a Query from the QueryFavourites using it's ID
+QueryFavourites.prototype.get = function(id) {
+	var broker = null;
+	var result = null;
+	try {
+		broker = PersistenceBrokerFactory.defaultPersistenceBroker();
+		var criteria = criteria = new Criteria();
+		criteria.addEqualTo("id", new java.lang.Long(id));
+		//criteria.addEqualTo("user", new String(this._user));
+    var query = new QueryByCriteria(SimpleLuceneQueryBean, criteria);
+		result = broker.getObjectByQuery(query);
+	} catch (e) {
+		cocoon.log.error(e);
+		throw("error.no.favourite");
+	} finally {
+		if (broker != null) broker.close();
+	}
+	return result;	
+}
+
+// get a list of Queries from the QueryFavourites
+QueryFavourites.prototype.list = function() {
+	var broker = null;
+	var result = null;
+	try {
+		broker = PersistenceBrokerFactory.defaultPersistenceBroker();
+		var criteria = criteria = new Criteria();
+		criteria.addEqualTo("user", new String(this._user));
+    var query = new QueryByCriteria(SimpleLuceneQueryBean, criteria);
+    query.addOrderByAscending("date");
+		result = broker.getCollectionByQuery(query);
+	} finally {
+		if (broker != null) broker.close();
+	}
+	return result;	
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QueryHistory.js
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QueryHistory.js?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QueryHistory.js (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QueryHistory.js Fri Mar 11 04:52:08 2005
@@ -0,0 +1,91 @@
+/*
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+*/
+
+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, clone) {
+	var item;
+	try {
+		item = this._history.get(parseInt(id));
+	} catch (e1) {
+		cocoon.log.error(e1);
+		throw("error.no.history");
+	}
+	try {
+		if (clone) {
+			return item.clone();
+		} else {
+			return item;
+		}
+	} catch (e2) {
+		cocoon.log.error(e2);
+		throw("items stored in history need to be Cloneable");
+	}
+}
+
+// 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/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QuerySearcher.js
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QuerySearcher.js?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QuerySearcher.js (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/QuerySearcher.js Fri Mar 11 04:52:08 2005
@@ -0,0 +1,140 @@
+/*
+  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);
+importClass(Packages.org.apache.cocoon.bean.query.SimpleLuceneQuery)
+importClass(Packages.org.apache.cocoon.bean.query.SimpleLuceneQueryBean)
+importClass(Packages.org.apache.cocoon.bean.query.SimpleLuceneCriterion)
+importClass(Packages.org.apache.cocoon.bean.query.SimpleLuceneCriterionBean)
+importClass(Packages.org.apache.cocoon.bean.query.ContextAccess)
+
+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 from history
+QuerySearcher.prototype.page = function(page, id, history) {
+	var p;
+	var query = history.get(id, true);
+	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) {
+	if (query.total > this._high) {
+		return ("query.tip.high");
+	} else if (query.total < this._low) {
+		var allProhibited = true;
+		var criteria = query.getCriteria();
+		for (var i = 0; i < criteria.size(); i++) {
+			if (!criteria.get(i).isProhibited()) {
+				allProhibited = false;
+				break;
+			}
+		}
+		if (allProhibited) {
+			return ("query.tip.prohibited");
+		} else {
+			return ("query.tip.low");
+		}
+	} else {
+		return null;
+	}
+}
+
+
+

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/indexer.js
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/indexer.js?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/indexer.js (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/indexer.js Fri Mar 11 04:52:08 2005
@@ -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/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/pager.js
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/pager.js?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/pager.js (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/pager.js Fri Mar 11 04:52:08 2005
@@ -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/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/query.js
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/query.js?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/query.js (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/flow/query.js Fri Mar 11 04:52:08 2005
@@ -0,0 +1,138 @@
+/*
+  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"], {history: 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.sendPage("screen/error", {message: error});
+	}
+}
+
+
+// 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"], false);
+		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});
+	}
+}
+
+// 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});
+	}
+}
+
+// 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"], true);
+			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();
+	}
+}
+
+
+// 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/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-binding.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-binding.xml?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-binding.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-binding.xml Fri Mar 11 04:52:08 2005
@@ -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/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-fields.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-fields.xml?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-fields.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-fields.xml Fri Mar 11 04:52:08 2005
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<fd:selection-list
+	xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" 
+	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+>
+<!-- The field selectionlist for the CForms Model for editing an advanced query -->
+<!-- $Id: advanced-fields.xml 30942 2004-07-29 20:16:54Z vgritsenko $ -->
+
+<!-- 
+	Edit this list to suit the way your content is indexed.
+	
+	Make an fd:item for each field you want the user to be able to search
+	The @value represents the name of the Lucene Index field.
+	
+	The special value of "any" is reserved to mean "any field".
+-->
+	<fd:item value="any">
+		<fd:label><i18n:text i18n:catalogue="local">field.any.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="title">
+		<fd:label><i18n:text i18n:catalogue="local">field.title.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="question">
+		<fd:label><i18n:text i18n:catalogue="local">field.question.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="answer">
+		<fd:label><i18n:text i18n:catalogue="local">field.answer.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="source">
+		<fd:label><i18n:text i18n:catalogue="local">field.source.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="s1@title">
+		<fd:label><i18n:text i18n:catalogue="local">field.s1@title.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="s2@title">
+		<fd:label><i18n:text i18n:catalogue="local">field.s2@title.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="person@name">
+		<fd:label><i18n:text i18n:catalogue="local">field.person@name.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="p">
+		<fd:label><i18n:text i18n:catalogue="local">field.p.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="link">
+		<fd:label><i18n:text i18n:catalogue="local">field.link.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="code">
+		<fd:label><i18n:text i18n:catalogue="local">field.code.label</i18n:text></fd:label>
+	</fd:item>
+	<fd:item value="abstract">
+		<fd:label><i18n:text i18n:catalogue="local">field.abstract.label</i18n:text></fd:label>
+	</fd:item>
+</fd:selection-list>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-model.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-model.xml?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-model.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-model.xml Fri Mar 11 04:52:08 2005
@@ -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/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-template.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-template.xml?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-template.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/advanced-template.xml Fri Mar 11 04:52:08 2005
@@ -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/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/simple-binding.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/simple-binding.xml?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/simple-binding.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/simple-binding.xml Fri Mar 11 04:52:08 2005
@@ -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/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/simple-fields.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/simple-fields.xml?view=auto&rev=157073
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/simple-fields.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/querybean/samples/forms/simple-fields.xml Fri Mar 11 04:52:08 2005
@@ -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>



Mime
View raw message