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/06/21 12:00:23 UTC

cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components ContextHelper.java

jeremy      2004/06/21 03:00:23

  Modified:    src/blocks/lucene/samples sitemap.xmap welcome-index.xsp
               src/blocks/lucene/samples/stylesheets content2lucene.xsl
                        search-index2html.xsl
               src/java/org/apache/cocoon/components ContextHelper.java
  Added:       src/blocks/lucene/java/org/apache/cocoon/bean/query
                        ContextAccess.java SimpleLuceneCriterion.java
                        SimpleLuceneCriterionBean.java
                        SimpleLuceneQuery.java SimpleLuceneQueryBean.java
               src/blocks/lucene/samples/query query.js sitemap.xmap
               src/blocks/lucene/samples/query/screens advanced-binding.xml
                        advanced-fields.xml advanced-model.xml
                        advanced-template.xml error.xml history.xml
                        index.xml messages.xml results.xml
                        simple-binding.xml simple-fields.xml
                        simple-model.xml simple-template.xml
  Log:
  Adding Query Bean and samples to Lucene, along with some alterations to the SimpleCocoonSearcher interface
  
  Revision  Changes    Path
  1.1                  cocoon-2.1/src/blocks/lucene/java/org/apache/cocoon/bean/query/ContextAccess.java
  
  Index: ContextAccess.java
  ===================================================================
  /*
   * 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,v 1.1 2004/06/21 10:00:20 jeremy Exp $
   */
  
  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;
      }
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneCriterion.java
  
  Index: SimpleLuceneCriterion.java
  ===================================================================
  /*
    Copyright 1999-2004 The Apache Software Foundation
  
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
  
        http://www.apache.org/licenses/LICENSE-2.0
  
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
  */
  
  package org.apache.cocoon.bean.query;
  
  import org.apache.lucene.search.Query;
  import org.apache.lucene.analysis.Analyzer;
  
  
  /**
   * The interface of a criterion bean.
   * <p>
   *   This component defines an interface for searching.
   *   The idea is to abstract the process of searching into a Bean to be manipulated by CForms.
   * </p>
   *
   * @version CVS $Id: SimpleLuceneCriterion.java,v 1.1 2004/06/21 10:00:20 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 ();
  	
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneCriterionBean.java
  
  Index: SimpleLuceneCriterionBean.java
  ===================================================================
  /*
    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/06/21 10:00:20 jeremy Exp $
   */
  public class SimpleLuceneCriterionBean implements SimpleLuceneCriterion {
  
  	/**
  	 * The Bean's ID.
  	 */
  	private Long mId;
  
  	/**
  	 * The Bean's index field to seach in.
  	 */
  	private String mField;
  
  	/**
  	 * The Bean's match value.
  	 */
  	private String mMatch;
  
  	/**
  	 * The Bean's search term.
  	 */
  	private String mValue;
  	
  	/**
  	 * Default constructor.
  	 */
  	public SimpleLuceneCriterionBean() {
  	}
  
  
  	/**
  	 * Utility constructor.
  	 *
  	 * @param match the kind of match to use
  	 * @param field the field to search
  	 * @param value the terms to search for
  	 */
  	public SimpleLuceneCriterionBean(String field, String match, String value) {
  		mField = field;
  		mMatch = match;
  		mValue = value;
  	}
  	
  	/**
  	 * Clones the Bean for the history
  	 *
  	 * @return a deep copy of this Bean. 
  	 */
  	public SimpleLuceneCriterionBean copy () {
  		SimpleLuceneCriterionBean criterion = new SimpleLuceneCriterionBean ();
  		if (mField != null) criterion.setField (new String (mField));
  		if (mMatch != null) criterion.setMatch (new String (mMatch));
  		if (mValue != null) criterion.setValue (new String (mValue));
  		return criterion;
  	}
  
  	/**
  	 * Gets the <code>org.apache.lucene.search.Query</code> from the Criterion
  	 * <p>
  	 *   The analyzer specifies which <code>org.apache.lucene.analysis.Analyzer</code> to use for this search.
  	 * </p>
  	 *
  	 * @param  analyzer  The <code>org.apache.lucene.analysis.Analyzer</code> to use to extract the Terms from this Criterion
  	 */
  	public Query getQuery (Analyzer analyzer) {
  		String field = mField;
  		Query query = null;
  		if (ANY_FIELD.equals (mField)) field = LuceneXMLIndexer.BODY_FIELD;
  		// extract Terms from the query string
      TokenStream tokens = analyzer.tokenStream (field, new StringReader (mValue));
      Vector words = new Vector ();
      Token token;
      while (true) {
        try {
          token = tokens.next ();
        } catch (IOException e) {
          token = null;
        }
        if (token == null) break;
        words.addElement (token.termText ());
      }
      try {
        tokens.close ();
      } catch (IOException e) {} // ignore 
  		
  		// assemble the different matches
  		
  		if (ANY_MATCH.equals (mMatch)) {
  			if (words.size () > 1) {
  				query = new BooleanQuery ();
  				for (int i = 0; i < words.size (); i++) {
  					((BooleanQuery)query).add (new TermQuery (new Term (field, (String)words.elementAt(i))), false, false);
  				}
  			} else if (words.size () == 1) {
  				query = new TermQuery (new Term (field, (String)words.elementAt(0)));
  			}
  		} 
  		
  		if (ALL_MATCH.equals (mMatch)) {
  			if (words.size () > 1) {
  				query = new BooleanQuery ();
  				for (int i = 0; i < words.size (); i++) {
  					((BooleanQuery)query).add (new TermQuery (new Term (field, (String)words.elementAt(i))), true, false);
  				}
  			} else if (words.size () == 1) {
  				query = new TermQuery (new Term (field, (String)words.elementAt(0)));
  			}
  		} 
  		
  		if (NOT_MATCH.equals (mMatch)) {
  			if (words.size () > 1) {
  				query = new BooleanQuery ();
  				for (int i = 0; i < words.size (); i++) {
  					((BooleanQuery)query).add (new TermQuery (new Term (field, (String)words.elementAt(i))), true, true);
  				}
  			} else if (words.size () == 1) {
  				query = new TermQuery (new Term (field, (String)words.elementAt(0)));
  			}
  		} 
  		
  		if (LIKE_MATCH.equals (mMatch)) {
  			if (words.size () > 1) {
  				query = new BooleanQuery ();
  				for (int i = 0; i < words.size (); i++) {
  					((BooleanQuery)query).add (new FuzzyQuery (new Term (field, (String)words.elementAt(i))), false, false);
  				}
  			} else if (words.size () == 1) {
  				query = new FuzzyQuery (new Term (field, (String)words.elementAt(0)));
  			}
  		}
  		
  		if (PHRASE_MATCH.equals (mMatch)) {
  			if (words.size () > 1) {
  				query = new PhraseQuery ();
  				((PhraseQuery)query).setSlop (0);
  				for (int i = 0; i < words.size (); i++) {
  					((PhraseQuery)query).add (new Term (field, (String)words.elementAt(i)));
  				}
  			} else if (words.size () == 1) {
  				query = new TermQuery (new Term (field, (String)words.elementAt(0)));
  			}
  		}
  		return query;
  	}
  	
  	/**
  	 * Gets the prohibited status from the Criterion
  	 */
  	public boolean isProhibited () {
  		if (NOT_MATCH.equals (mMatch)) return true;
  		return false;
  	}
  	
  	
  	// Bean
  	
  	/**
  	 * Gets the Bean's ID
  	 *
  	 * @return the <code>Long</code> ID of the Bean. 
  	 */
  	public Long getId() {
  		return mId;
  	}
  	
  	/**
  	 * Sets the Bean's ID
  	 *
  	 * @param id the <code>Long</code> ID of the Bean. 
  	 */
  	public void setId(Long id) {
  		mId = id;
  	}
  	
  	/**
  	 * Gets the Bean's field
  	 *
  	 * @return the <code>String</code> field of the Bean. 
  	 */
  	public String getField() {
  		return mField;
  	}
  	
  	/**
  	 * Sets the Bean's field.<br/>
  	 * ie. which field would you like this Criterion to search in.
  	 *
  	 * @param field the <code>String</code> field of the Bean. 
  	 */
  	public void setField(String field) {
  		mField = field;
  	}
  	
  	/**
  	 * Gets the Bean's match
  	 *
  	 * @return the <code>String</code> match of the Bean. 
  	 */
  	public String getMatch() {
  		return mMatch;
  	}
  	
  	/**
  	 * Sets the Bean's match.<br/>
  	 * ie. what kind of match do you want performed by this Criterion.
  	 *
  	 * @param match the <code>String</code> match of the Bean. 
  	 */
  	public void setMatch(String match) {
  		mMatch = match;
  	}
  	
  	/**
  	 * Gets the Bean's value
  	 *
  	 * @return the <code>String</code> value of the Bean. 
  	 */
  	public String getValue() {
  		return mValue;
  	}
  	
  	/**
  	 * Sets the Bean's value.<br/>
  	 * ie. the string of search terms for this <code>Criterion</code>.
  	 *
  	 * @param value the <code>String</code> value of the Bean. 
  	 */
  	public void setValue(String value) {
  		mValue = value.trim ();
  	}
  
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneQuery.java
  
  Index: SimpleLuceneQuery.java
  ===================================================================
  /*
    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.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/06/21 10:00:20 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 java.io.IOException, ProcessingException;
  
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/java/org/apache/cocoon/bean/query/SimpleLuceneQueryBean.java
  
  Index: SimpleLuceneQueryBean.java
  ===================================================================
  /*
    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.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/06/21 10:00:20 jeremy Exp $
   */
  public class SimpleLuceneQueryBean implements SimpleLuceneQuery {
  
  	/**
  	 * The DEFAULT_PAGE_SIZE of this bean.
  	 * ie. <code>20</code>
  	 */
  	public static Long DEFAULT_PAGE_SIZE = new Long (20);
  
  	/**
  	 * The SCORE_FIELD of this bean.
  	 * This is the key of the Lucene Score as output by this Bean in each hit.
  	 * ie. <code>_lucene-score_</code>
  	 */
  	public static String SCORE_FIELD = "_lucene-score_";
  
  	/**
  	 * The INDEX_FIELD of this bean.
  	 * This is the key of the hit index as output by this Bean in each hit.
  	 * ie. <code>_lucene-index_</code>
  	 */
  	public static String INDEX_FIELD = "_lucene-index_";
  
  	/**
  	 * The date this Query was created.
  	 */
  	private Date mDate; 
  
  	/**
  	 * The Bean's list of Criteria.
  	 */
  	private List mCriteria;
  
  	/**
  	 * The Bean's ID.
  	 */
  	private Long mId;
  
  	/**
  	 * The Bean's current page.
  	 */
  	private Long mPage; 
  
  	/**
  	 * The Bean's page isze.
  	 */
  	private Long mSize; 
  
  	/**
  	 * The Bean's hit count.
  	 */
  	private Long mTotal; 
  
  	/**
  	 * The Bean's query boolean.
  	 */
  	private String mBool;
  
  	/**
  	 * The Bean's query name.
  	 */
  	private String mName;
  
  	/**
  	 * The Bean's query type.
  	 */
  	private String mType;
  
  	/**
  	 * The Bean's searcher.
  	 */
  	private LuceneCocoonSearcher searcher;
  	
  	/**
  	 * Default constructor.
  	 */
  	public SimpleLuceneQueryBean() {
  	}
  
  	/**
  	 * Utility constructor.
  	 *
  	 * @param type the type of this query
  	 * @param bool the kind of boolean opperation to apply to each of it's Criteria
  	 * @param match the kind of match to use for the generated <code>Criterion</code>
  	 * @param field the field to search for the generated <code>Criterion</code>
  	 * @param query the terms to search for the generated <code>Criterion</code>
  	 */
  	public SimpleLuceneQueryBean(String type, String bool, String match, String field, String query) {
  		mName = "My Query";
  		mType = type;
  		mBool = bool;
  		mSize = DEFAULT_PAGE_SIZE;
  		mPage = new Long (0);
  		mTotal = null;
  		this.addCriterion (new SimpleLuceneCriterionBean (field, match, query));
  	}
  	
  	/**
  	 * Clones the Bean for the history
  	 *
  	 * @return a deep copy of this Bean. 
  	 */
  	public SimpleLuceneQuery copy() {
  		SimpleLuceneQueryBean query = new SimpleLuceneQueryBean ();
  		if (mName != null) query.setName (new String (mName));
  		if (mType != null) query.setType (new String (mType));
  		if (mBool != null) query.setBool (new String (mBool));
  		query.setSize (DEFAULT_PAGE_SIZE);
  		query.setPage (new Long (0));
  		query.setTotal (null);
  		if (mDate != null) {
  			query.setDate (new Date (mDate.getTime ()));
  		} else {
  			query.setDate (new Date ());
  		}
  		Iterator i = this.getCriteria().iterator ();
  		while (i.hasNext()) query.addCriterion (((SimpleLuceneCriterionBean)i.next()).copy ());
  		return query;
  	}
  	
  	/**
  	 * Gets the Bean to perform it's query
  	 * <p>
  	 *   The searcher specifies which LuceneCocoonSearcher to use for this search.<br/>
  	 *   It needs to have been initialised properly before use.<br/>
  	 *   Each <code>Map</code> in the <code>List</code> returned by this method contains:
  	 *   <ul>
  	 *     <li>Each stored field from the Index</li>
  	 *     <li><code>SCORE_FIELD</code> the Lucene score</li>
  	 *     <li><code>INDEX_FIELD</code> the index of the hit</li>
  	 *   </ul>
  	 * </p>
  	 *
  	 * @param  searcher  The <code>LuceneCocoonSearcher</code> to use for this search
  	 * @return a List of Maps, each representing a Hit. 
  	 * @exception  ProcessingException thrown by the searcher
  	 * @exception  IOException thrown when the searcher's directory cannot be found
  	 */
  	public List search (LuceneCocoonSearcher searcher) throws java.io.IOException, ProcessingException {
  		BooleanQuery query = new BooleanQuery ();
  		Iterator criteria = mCriteria.iterator ();
  		boolean required = false;
  		if (AND_BOOL.equals (mBool)) required = true;
  		while (criteria.hasNext ()) {
  			SimpleLuceneCriterion criterion = (SimpleLuceneCriterion)criteria.next ();
  			Query subquery = criterion.getQuery (searcher.getAnalyzer ());
  			query.add (subquery, required, criterion.isProhibited ());
  		}
  		// TODO: how can this bean be both Persistable and LogEnabled ?
  		//System.out.println ("SimpleLuceneQueryBean: " + query.toString ());
  		Hits hits = searcher.search (query);
  		mTotal = new Long (hits.length ());
  		mDate = new Date ();
  		return page (hits);
  	}
  
  	/**
  	 * Outputs part of a Hit List according to the Bean's paging properties.
  	 *
  	 * @param  hits  The Lucene Hits you want to page
  	 * @return a List of Maps, each representing a Hit. 
  	 * @exception  IOException thrown when the searcher's directory cannot be found
  	 */
  	private List page (Hits hits)  throws java.io.IOException {
  		ArrayList results = new ArrayList ();
  		int start = mPage.intValue () * mSize.intValue ();
  		if (start > mTotal.intValue ()) start = mTotal.intValue (); 
  		int end = start + mSize.intValue ();
  		if (end > mTotal.intValue ()) end = mTotal.intValue (); 
  		for (int i = start; i < end; i++) {
  			HashMap hit = new HashMap ();
  			hit.put (SCORE_FIELD, new Float (hits.score (i)));
  			hit.put (INDEX_FIELD, new Long (i));
  			Document doc = hits.doc (i);
  			for (Enumeration e = doc.fields (); e.hasMoreElements (); ) {
  				Field field = (Field)e.nextElement ();
  				if (field.name ().equals (SCORE_FIELD)) continue;
  				if (field.name ().equals (INDEX_FIELD)) continue;
  				hit.put (field.name (), field.stringValue ());
        }
  			results.add (hit);
  		}
  		return (results);
  	}
  	
  	/**
  	 * Gets the Bean's ID.
  	 *
  	 * @return the <code>Long</code> ID of the Bean. 
  	 */
  	public Long getId() {
  		return mId;
  	}
  	
  	/**
  	 * Sets the Bean's ID.
  	 *
  	 * @param id the <code>Long</code> ID of the Bean. 
  	 */
  	public void setId(Long id) {
  		mId = id;
  	}
  	
  	/**
  	 * Gets the Bean's name.
  	 *
  	 * @return the <code>String</code> name of the Bean. 
  	 */
  	public String getName() {
  		return mName;
  	}
  	
  	/**
  	 * Sets the Bean's Name.
  	 *
  	 * @param id the <code>String</code> name of the Bean. 
  	 */
  	public void setName(String name) {
  		mName = name;
  	}
  
  	/**
  	 * Gets the Bean's type.
  	 *
  	 * @return the <code>String</code> type of the Bean. 
  	 */
  	public String getType() {
  		return mType;
  	}
  	
  	/**
  	 * Sets the Bean's type.
  	 *
  	 * @param type the <code>String</code> type of the Bean. 
  	 */
  	public void setType(String type) {
  		mType = type;
  	}
  
  	/**
  	 * Gets the Bean's boolean operator.
  	 *
  	 * @return the <code>String</code> boolean of the Bean. 
  	 */
  	public String getBool() {
  		return mBool;
  	}
  	
  	/**
  	 * Sets the Bean's boolean operator.
  	 * ie. which kind of boolean operation do you want performed on each <code>Criterion</code>.
  	 *
  	 * @param bool the <code>String</code> boolean of the Bean. 
  	 */
  	public void setBool(String bool) {
  		mBool = bool;
  	}
  	
  	/**
  	 * Gets the Bean's page size
  	 *
  	 * @return the <code>Long</code> page size of the Bean. 
  	 */
  	public Long getSize() {
  		return mSize;
  	}
  	
  	/**
  	 * Sets the Bean's page size.
  	 * ie. how many hits do you want this Bean to show on in page.
  	 *
  	 * @param size the <code>Long</code> page size of the Bean. 
  	 */
  	public void setSize(Long size) {
  		mSize = size;
  	}
  	
  	/**
  	 * Gets the Bean's page index
  	 *
  	 * @return the <code>Long</code> page index of the Bean. 
  	 */
  	public Long getPage() {
  		return mPage;
  	}
  	
  	/**
  	 * Sets the Bean's page index.
  	 * ie. which page do you want this Bean to show.
  	 *
  	 * @param page the <code>Long</code> page index of the Bean. 
  	 */
  	public void setPage(Long page) {
  		mPage = page;
  	}
  
  	/**
  	 * Gets the Bean's hit count.
  	 *
  	 * @return the <code>Long</code> hit count of the Bean. 
  	 */
  	public Long getTotal() {
  		return mTotal;
  	}
  	
  	/**
  	 * Sets the Bean's hit count.
  	 *
  	 * @param total the <code>Long</code> hit count of the Bean. 
  	 */
  	public void setTotal(Long total) {
  		mTotal = total;
  	}
  
  	/**
  	 * Gets the Bean's inception date.
  	 *
  	 * @return the <code>Date</code> of the Bean. 
  	 */
  	public Date getDate() {
  		return mDate;
  	}
  	
  	/**
  	 * Sets the Bean's inception date.
  	 *
  	 * @param date the <code>Date</code> inception date of the Bean. 
  	 */
  	public void setDate(Date date) {
  		mDate = date;
  	}
  
  	/**
  	 * Gets the Bean's criteria.
  	 *
  	 * @return the <code>List</code> of Bean Query criteria. 
  	 */
  	public List getCriteria() {
  		return mCriteria;
  	}
  	
  	/**
  	 * Sets the Bean's criteria.
  	 *
  	 * @param criteria the <code>List</code> of Bean Query criteria. 
  	 */
  	public void setCriteria(List criteria) {
  		mCriteria = criteria;
  	}
  
  	/**
  	 * Adds a <code>Criterion</code> the Bean.
  	 *
  	 * @param criterion the <code>SimpleLuceneCriterionBean</code> to add to the Bean. 
  	 */
  	public void addCriterion(SimpleLuceneCriterionBean criterion) {
  		if (mCriteria == null) mCriteria = new ArrayList ();
  		mCriteria.add (criterion);
  	}
  
  	/**
  	 * Removes a <code>Criterion</code> from the Bean.
  	 *
  	 * @param criterion the <code>SimpleLuceneCriterionBean</code> to remove from the Bean. 
  	 */
  	public void removeCriterion(SimpleLuceneCriterionBean criterion) {
  		if (mCriteria != null) mCriteria.remove (criterion);
  	}
  	
  }
  
  
  
  1.7       +6 -0      cocoon-2.1/src/blocks/lucene/samples/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/lucene/samples/sitemap.xmap,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- sitemap.xmap	11 Mar 2004 16:25:48 -0000	1.6
  +++ sitemap.xmap	21 Jun 2004 10:00:20 -0000	1.7
  @@ -60,6 +60,12 @@
   <map:pipelines>
     
     <map:pipeline>
  +  	
  +		<!-- mount query bean pipelines -->
  +		<map:match pattern="query/**">
  +			<map:mount check-reload="yes" src="query.xmap" uri-prefix="query"/>
  +		</map:match>
  +
       <map:match pattern="images/*.gif">
         <map:read src="images/{1}.gif" mime-type="image/gif">
           <map:parameter name="expires" value="60000"/>
  
  
  
  1.6       +9 -0      cocoon-2.1/src/blocks/lucene/samples/welcome-index.xsp
  
  Index: welcome-index.xsp
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/lucene/samples/welcome-index.xsp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- welcome-index.xsp	22 Apr 2004 07:33:45 -0000	1.5
  +++ welcome-index.xsp	21 Jun 2004 10:00:20 -0000	1.6
  @@ -93,6 +93,15 @@
           Enter a query and search the Lucene index2 that you have created
           - using <a href="findIt2?queryString=cocoon">Cocoon Generators</a>.
         </p>
  +      <p>
  +        Construct a query and search the Lucene index2 that you have created
  +        - using <a href="query/advanced.html">Cocoon Forms</a>.<br/>
  +        Or enter a word or two in here : 
  +        	<form action="query/fulltext.html">
  +        		<input type="text" name="query" size="20" />
  +        		<input type="submit" value="Search" />
  +        	</form>
  +      </p>
         
         <h2>Internals</h2>
         <p>
  
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/query.js
  
  Index: query.js
  ===================================================================
  /*
    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.1 2004/06/21 10:00:20 jeremy Exp $
  
  
  cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
  
  importClass (Packages.org.apache.cocoon.Constants);
  importPackage (Packages.org.apache.cocoon.bean.query);
  importClass (Packages.org.apache.cocoon.components.search.LuceneCocoonSearcher);
  importClass (Packages.org.apache.cocoon.components.search.LuceneCocoonHelper);
  
  
  var SESSION_ATTR = "_query_bean_history_"; // the name of the Session Attribute used by this code
  var STANDARD_ANALYZER = "org.apache.lucene.analysis.standard.StandardAnalyzer";
  
  // display the User's Search History
  function history () {
  	var history = getHistory ();
  	var count = history.size ();
  	var histlist = new java.util.ArrayList (count);
  	var index = 0;
  	for (var position = 0; position < count; position++) {
  		index = count - position - 1; // reverse the order
  		histlist.add (position, {id: new java.lang.Long (index), query: history.get (index)});
  	}
  	cocoon.sendPage (cocoon.parameters["screen"], {history: histlist});
  }
  
  // perform Searches
  function simpleLuceneQuery () {
  	var screen = cocoon.parameters["screen"];
  	var type = cocoon.parameters["type"];
  	var historyid = cocoon.parameters["id"];
  	var directory = cocoon.parameters["lucene-directory"];
  	var query = null;
  	var page = null;
  	var results = null;
  	var history = getHistory ();
  	var searcher = cocoon.getComponent (LuceneCocoonSearcher.ROLE);
  	var contextAccess = cocoon.createObject (ContextAccess);
  	var avalonContext = contextAccess.getAvalonContext ();
  	try {
  		if ( !"".equals (cocoon.parameters["page"]) ) page = new java.lang.Long (cocoon.parameters["page"]);
  		if ( !"".equals (cocoon.parameters["query"]) ) { // test for: quick ?query
  			query = new SimpleLuceneQueryBean (type, null, SimpleLuceneCriterion.ANY_MATCH, SimpleLuceneCriterion.ANY_FIELD, cocoon.parameters["query"]);
  		} else if ( "".equals (historyid) ) {            // test for: new query
  			query = new SimpleLuceneQueryBean (type, null, SimpleLuceneCriterion.ANY_MATCH, SimpleLuceneCriterion.ANY_FIELD, "");
  			edit (query);
  		} else {
  			try {
  				var edition = history.get (historyid);
  				if (page == null) {                          // edit a query already in the history
  					query = edition.copy ();                   // clone it first so history items are separate
  					edit (query);    
  				} else {                                     // page a query already in the history
  					query = edition;
  					query.page = page;
  				}		
  			} catch (e) {
  				cocoon.sendPage("screen/error", {message: "search.error.nohistory"});
  				return;
  			}
  		}
  		if (query != null) {
  			try {
  				var index = getLuceneDirectory (avalonContext, directory)
  				if (index == null) {
  					cocoon.sendPage("screen/error", {message: "search.error.noindex"});
  					return;
  				}
  				searcher.setDirectory (index);
  				if (searcher.getAnalyzer () == null) searcher.setAnalyzer (LuceneCocoonHelper.getAnalyzer(STANDARD_ANALYZER));
  				results = query.search (searcher);
  			} catch (e) {
  				cocoon.log.error (e);
  				cocoon.sendPage("screen/error", {message: e});
  				return;
  			}
  			var nav = pagerNavigation (query.total, query.page, query.size);
  			if (page == null) {
  				history.add (query); 													// add a fresh query to the history
  			} else {
  				history.remove (query); 											// move move a paged query to the top
  				history.add (query);
  			}
  			historyid = new java.lang.Long (history.size () -1); 
  			cocoon.sendPage (screen, {result: { results: results, nav: nav, query: query, id: historyid }});
  		} else {
  			cocoon.sendPage("screen/error", {message: "search.error.noquery"});
  		}
  	} catch (e) {
  		cocoon.log.error (e);
  		cocoon.sendPage("screen/error", {message: e});
  	} finally {
  		cocoon.releaseComponent (searcher);
  		cocoon.disposeObject (contextAccess);
  	}
  }
  
  // allow the user to edit the query
  function edit (query) {
  	var form = new Form (cocoon.parameters["form-definition"]);
  	form.createBinding (cocoon.parameters["bindingURI"]);
  	form.load (query);
  	form.showForm (cocoon.parameters["form"]);
  	if ("submit".equals (form.submitId)) {
  		form.save (query);
  	}
  }
  
  // get or setup the User's History in the Session
  function getHistory () {
  	var history = cocoon.session.getAttribute (SESSION_ATTR);
  	if (history == null) {
  		history = new java.util.ArrayList ();
  		cocoon.session.setAttribute (SESSION_ATTR, history);
  	}
  	return history;
  }
  
  // Utility function to work out the directory to use as the Lucene Index 
  function getLuceneDirectory (avalonContext, directory) {
  	var index = new java.io.File (directory);
  	if (!index.isAbsolute ()) {
  		var workDir = avalonContext.get (Constants.CONTEXT_WORK_DIR);
  		index = new java.io.File(workDir, directory);
  	}
  	if (!index.exists ()) {
  		return null;
  	} else {
  		return LuceneCocoonHelper.getDirectory (index, false);
  	}
  }
  
  // Utility function to create a 'paging record' for the display of long paged lists of records 
  function pagerNavigation (total, page, size) {
  	var pages = Math.ceil (total/size);
  	var index = new java.util.ArrayList ();
  	var off = 5; // half the max # of slots to see
  	var start = 0;
  	var end = pages;
  	if (pages > (off*2)) {
  		if (page < off) { // if we are close to the left
  			start = 0;
  			end = start + (off*2);
  		} else if (page > (pages - off)) { // if we are close to the right
  			start = pages - (off*2);
  			end = pages;
  		} else { // we are somewhere in the middle
  			start = page - off;
  			end = page.intValue () + off;
  		}
  	} 
  	for (var i = start; i < end; i++) index.add (new java.lang.Integer (i));
  	var firstIndex = 0;
  	var lastIndex = 0;
  	try {
  		firstIndex = index.get (0);
  		lastIndex = index.get (index.size()-1);
  	} catch (e) {}
  	return (
  		{ 
  			total: total, 
  			next: total > (page.intValue () * size.intValue ()) + size.intValue () ? new java.lang.Integer (page.intValue () + 1) : null, 
  			prev: page > 0 ? new java.lang.Integer (page - 1) : null, 
  			size: new java.lang.Integer (size), 
  			page: new java.lang.Integer (page), 
  			pages: new java.lang.Integer (pages),
  			index: index,
  			firstIndex: firstIndex,
  			lastIndex: lastIndex
  		}
  	);
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  <?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.
  -->
  
  <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  
  <!-- =========================== Components =================================== -->
  
  	<map:components>
  		<map:transformers default="xalan">
  			<map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer">
  				<catalogues default="forms">
  					<catalogue id="local" name="messages" location="screens"/>
  					<catalogue id="forms" name="FormsMessages" location="context://samples/blocks/forms/messages"/>
  				</catalogues>
  				<cache-at-startup>true</cache-at-startup>
  			</map:transformer>
  		</map:transformers>
  		<map:pipes default="caching"/>
  	</map:components>
  
  <!-- =========================== FlowScripts =================================== -->
  
  	<map:flow language="javascript">
  		<map:script src="query.js"/>
  	</map:flow>
  
  <!-- =========================== Views =================================== -->
  
  <map:views>
    <map:view name="content" from-label="content">
     <map:serialize type="xml"/>
    </map:view>
  
    <map:view from-label="content" name="pretty-content">
     <map:transform src="context://stylesheets/system/xml2html.xslt"/>
     <map:serialize type="html"/>
    </map:view>
  
    <map:view name="links" from-position="last">
     <map:serialize type="links"/>
    </map:view>
  
  </map:views>
  
  <!-- =========================== Pipelines ================================= -->
  
  <map:pipelines>
  
  		<map:pipeline internal-only="true">
  		
  			<map:act type="locale">
  			
  				<!-- displays the forms -->
  				<map:match pattern="form/*">
  					<map:generate type="jx" src="screens/{1}-template.xml"/>
  					<map:transform type="forms">
  						<map:parameter name="locale" value="{../locale}"/>  
  					</map:transform>
  					<map:transform type="i18n">
  						<map:parameter name="locale" value="{../locale}"/>  
  					</map:transform>
  					<map:transform src="context://samples/blocks/forms/resources/forms-samples-styling.xsl"/>
  					<map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl">
  						<map:parameter name="contextPath" value="{request:contextPath}"/>
  					</map:transform>
  					<map:serialize/>
  				</map:match>
  	
  				<!-- displays the screens -->
  				<map:match pattern="screen/*">
  					<map:generate type="jx" src="screens/{1}.xml"/>
  					<map:transform type="i18n">
  						<map:parameter name="locale" value="{../locale}"/>  
  					</map:transform>
  					<map:transform src="context://samples/common/style/xsl/html/simple-page2html.xsl">
  						<map:parameter name="contextPath" value="{request:contextPath}"/>
  					</map:transform>
  					<map:serialize/>
  				</map:match>
  				
  			</map:act>
  
  		</map:pipeline>
    
  		<map:pipeline>
  
  			<!--					
  			 Used for CForms Continuations
  			
  			 must be placed before external page pipelines
  			 and after internal screen pipelines
  			 otherwise you get infinite loops					 
  			-->				
  			<map:match type="request-parameter" pattern="continuation-id">
  				<map:call continuation="{1}"/>
  			</map:match>
  
  			<!-- home page -->
      	<map:match pattern="">
      		<map:redirect-to uri="cocoon:/screen/index"/>
        </map:match>
  
  			<!-- history page -->
  			<map:match pattern="history.html">
  				<map:call function="history">
  					<map:parameter name="screen" value="screen/history"/> 									<!-- the history screen cocoon:/ pipeline -->
  				</map:call>
  			</map:match>
  
  			<!-- searches -->
  			<map:match pattern="*.html">
  				<map:call function="simpleLuceneQuery">
  					<map:parameter name="form-definition" value="screens/{1}-model.xml"/> 	<!-- the editing form definition file -->
  					<map:parameter name="bindingURI" value="screens/{1}-binding.xml"/> 			<!-- the editing form binding file -->
  					<map:parameter name="form" value="form/{1}"/> 													<!-- the editing form cocoon:/ pipeline -->
  					<map:parameter name="type" value="{1}"/> 																<!-- the query type -->
  					<map:parameter name="lucene-directory" value="index2"/> 								<!-- the lucene index -->
  					<map:parameter name="screen" value="screen/results"/> 									<!-- the search results cocoon:/ pipeline -->
  					<map:parameter name="query" value="{request-param:query}"/> 						<!-- the query param (for quick queries) -->
  					<map:parameter name="id" value="{request-param:id}"/> 									<!-- the history id param -->
  					<map:parameter name="page" value="{request-param:page}"/> 							<!-- the page param -->
  				</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>
  
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/screens/advanced-binding.xml
  
  Index: advanced-binding.xml
  ===================================================================
  <?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,v 1.1 2004/06/21 10:00:20 jeremy Exp $ -->
  <fb:context 
  	xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" 
  	xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" 
  	path="/"
  	>
  	
    <fb:value id="name" path="name"/>
    <fb:value id="type" path="type"/>
    <fb:value id="bool" path="bool"/>
  
    <fb:value id="size" path="size"/>
    <fb:value id="page" path="page"/>
    <fb:value id="total" path="total"/>
  
    <fb:repeater id="criteria" parent-path="." row-path="criteria">
    	<fb:identity><fb:value path="value" id="value"/></fb:identity>
  
  		<fb:on-bind>
  			<fb:value id="value" path="value"/>
  			<fb:value id="field" path="field"/>
  			<fb:value id="match" path="match"/>
  		</fb:on-bind>
  		
      <fb:on-delete-row>
        <fb:delete-node/>
      </fb:on-delete-row>
      <fb:on-insert-row>
  			<fb:insert-bean classname="org.apache.cocoon.bean.query.SimpleLuceneCriterionBean" addmethod="addCriterion"/>
      </fb:on-insert-row>
  
    </fb:repeater>
  
  </fb:context>
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/screens/advanced-fields.xml
  
  Index: advanced-fields.xml
  ===================================================================
  <?xml version="1.0" encoding="utf-8"?>
  <fd:selection-list
  	xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" 
  	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
  >
  <!--
    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 an advanced query -->
  <!-- $Id: advanced-fields.xml,v 1.1 2004/06/21 10:00:20 jeremy Exp $ -->
  
  <!-- 
  	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>
  
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/screens/advanced-model.xml
  
  Index: advanced-model.xml
  ===================================================================
  <?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,v 1.1 2004/06/21 10:00:20 jeremy Exp $ -->
  <fd:form 
  	xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" 
  	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
  >
  
    <fd:widgets>
  
      <fd:messages id="messages">
        <fd:label><i18n:text i18n:catalogue="local">message.label</i18n:text></fd:label>
      </fd:messages>
  
  		<fd:output id="id">
  			<fd:datatype base="string"/>
  		</fd:output>
  
  		<fd:field id="name" required="true">
  			<fd:label><i18n:text i18n:catalogue="local">query.name.label</i18n:text>: </fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">query.name.hint</i18n:text></fd:hint>
  			<fd:datatype base="string"/>
  		</fd:field>
  
  		<fd:output id="type">
  			<fd:datatype base="string"/>
  		</fd:output>
  
  		<fd:field id="bool" required="true">
  			<fd:label><i18n:text i18n:catalogue="local">query.bool.label</i18n:text>: </fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">query.bool.hint</i18n:text></fd:hint>
  			<fd:datatype base="string"/>
  			<!-- the @value(s) of this selection-list are bound to SimpleLuceneQuery -->
  			<fd:selection-list>
  				<fd:item value="or">
  					<fd:label><i18n:text i18n:catalogue="local">search.or.bool</i18n:text></fd:label>
  				</fd:item>
  				<fd:item value="and">
  					<fd:label><i18n:text i18n:catalogue="local">search.and.bool</i18n:text></fd:label>
  				</fd:item>
  			</fd:selection-list>
  		</fd:field>
  
  		<fd:field id="size" required="true">
  			<fd:label><i18n:text i18n:catalogue="local">paging.size.label</i18n:text>: </fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">paging.size.hint</i18n:text></fd:hint>
  			<fd:datatype base="long"/>
  			<fd:selection-list>
  				<fd:item value="10"/>
  				<fd:item value="20"/>
  				<fd:item value="30"/>
  				<fd:item value="40"/>
  				<fd:item value="50"/>
  			</fd:selection-list>
  		</fd:field>
  
  		<fd:field id="page" required="true">
  			<fd:label><i18n:text i18n:catalogue="local">paging.page.label</i18n:text>: </fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">paging.page.hint</i18n:text></fd:hint>
  			<fd:datatype base="long"/>
  		</fd:field>
  
  		<fd:output id="total">
  			<fd:label><i18n:text i18n:catalogue="local">paging.total.label</i18n:text>: </fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">paging.total.hint</i18n:text></fd:hint>
  			<fd:datatype base="long"/>
  		</fd:output>
  
  		<fd:submit id="cancel" action-command="cancel" validate="false">
  			<fd:label><i18n:text i18n:catalogue="local">cancel.label</i18n:text></fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">cancel.hint</i18n:text></fd:hint>
  		</fd:submit> 
  
  		<fd:submit id="submit" action-command="submit" validate="true">
  			<fd:label><i18n:text i18n:catalogue="local">submit.label</i18n:text></fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">submit.hint</i18n:text></fd:hint>
  		</fd:submit> 
  
      <fd:repeater id="criteria">
        <fd:widgets>
          
          <fd:field id="value" required="true">
            <fd:label><i18n:text i18n:catalogue="local">criterion.value.label</i18n:text>: </fd:label>
            <fd:hint><i18n:text i18n:catalogue="local">criterion.value.hint</i18n:text></fd:hint>
  					<fd:datatype base="string"/>
          </fd:field>
  				
  				<fd:field id="field" required="true">
  					<fd:label><i18n:text i18n:catalogue="local">criterion.field.label</i18n:text>: </fd:label>
  					<fd:hint><i18n:text i18n:catalogue="local">criterion.field.hint</i18n:text></fd:hint>
  					<fd:datatype base="string">
  						<fd:validation>
  							<fd:length min="2" max="64"/>
  						</fd:validation>
  					</fd:datatype>
  					<fd:selection-list src="screens/advanced-fields.xml"/>
  				</fd:field>
  
  				<fd:field id="match" required="true">
  					<fd:label><i18n:text i18n:catalogue="local">criterion.match.label</i18n:text>: </fd:label>
  					<fd:hint><i18n:text i18n:catalogue="local">criterion.match.hint</i18n:text></fd:hint>
  					<fd:datatype base="string"/>
  					<!-- the @value(s) of this selection-list are bound to SimpleLuceneCriterion -->
  					<fd:selection-list>
  						<fd:item value="any">
  							<fd:label><i18n:text i18n:catalogue="local">search.any.match</i18n:text></fd:label>
  						</fd:item>
  						<fd:item value="all">
  							<fd:label><i18n:text i18n:catalogue="local">search.all.match</i18n:text></fd:label>
  						</fd:item>
  						<fd:item value="like">
  							<fd:label><i18n:text i18n:catalogue="local">search.like.match</i18n:text></fd:label>
  						</fd:item>
  						<fd:item value="phrase">
  							<fd:label><i18n:text i18n:catalogue="local">search.phrase.match</i18n:text></fd:label>
  						</fd:item>
  						<fd:item value="not">
  							<fd:label><i18n:text i18n:catalogue="local">search.not.match</i18n:text></fd:label>
  						</fd:item>
  					</fd:selection-list>
  				</fd:field>
  
  				<fd:row-action id="delete" action-command="delete">
  					<fd:label><i18n:text i18n:catalogue="local">criterion.delete.label</i18n:text></fd:label>
  					<fd:hint><i18n:text i18n:catalogue="local">criterion.delete.hint</i18n:text></fd:hint>
  				</fd:row-action>
  
        </fd:widgets>
      </fd:repeater>
      
      <fd:repeater-action id="addcriterion" action-command="add-row" repeater="criteria">
        <fd:label><i18n:text i18n:catalogue="local">criterion.add.label</i18n:text></fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">criterion.add.hint</i18n:text></fd:hint>
      </fd:repeater-action>
      
    </fd:widgets>
  </fd:form>
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/screens/advanced-template.xml
  
  Index: advanced-template.xml
  ===================================================================
  <?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,v 1.1 2004/06/21 10:00:20 jeremy Exp $ -->
  <page 
  	xmlns:ft="http://apache.org/cocoon/forms/1.0#template" 
  	xmlns:fi="http://apache.org/cocoon/forms/1.0#instance" 
  	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
  >
  	<title><i18n:text i18n:catalogue="local">search.page.title</i18n:text> : <i18n:text i18n:catalogue="local">advanced.page.title</i18n:text></title>
  	<content>
  		<p><i18n:text i18n:catalogue="local">advanced.page.note</i18n:text></p>
  		<ft:form-template action="" method="POST">
  			<ft:continuation-id/>
  			<p class="woody-message"><ft:widget id="messages"/></p>
  			<fi:group>
  				<fi:styling type="fieldset" layout="columns"/>
  				<fi:label><i18n:text i18n:catalogue="local">advanced.query.label</i18n:text></fi:label>
  				<fi:hint>query editor layout</fi:hint>
  				<fi:items>
  					<ft:widget id="name"/>
  					<ft:widget id="bool"/>
  					<ft:widget id="addcriterion"/>
  					<ft:repeater-widget id="criteria">
  						<fi:group>
  							<fi:styling type="fieldset" layout="rows"/>
  							<fi:label><i18n:text i18n:catalogue="local">advanced.criterion.label</i18n:text></fi:label>
  							<fi:items>
  								<ft:widget id="field"/>
  								<ft:widget id="match"/>
  								<ft:widget id="value"/>
  								<ft:widget id="delete"/>
  							</fi:items>
  						</fi:group>
  					</ft:repeater-widget>
  					<ft:widget id="size"/>
  					<ft:widget id="page"/>
  				</fi:items>
  			</fi:group>
  			<i18n:text i18n:catalogue="local">required.note</i18n:text>
  			<ft:widget id="cancel"/>
  			<ft:widget id="submit"/>
  		</ft:form-template>
  	</content>
  </page>
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/screens/error.xml
  
  Index: error.xml
  ===================================================================
  <?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,v 1.1 2004/06/21 10:00:20 jeremy Exp $ -->
  <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>
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/screens/history.xml
  
  Index: history.xml
  ===================================================================
  <?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,v 1.1 2004/06/21 10:00:20 jeremy Exp $ -->
  <page
  	xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
  	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
  	>
  	<title><i18n:text i18n:catalogue="local">history.page.title</i18n:text></title>
  	<content>
  		<jx:choose>
  			<jx:when test="${history!=null}">
  				<p class="history.title">
  					<i18n:text i18n:catalogue="local">history.queries.title</i18n:text>: 
  					<span class="history.count"><jx:out value="${history.size()}"/></span>
  				</p>
  				<p class="links"> 
  					<a href="simple.html" title="local:new.simple.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">new.simple.label</i18n:text></a>
  					<span> | </span>
  					<a href="advanced.html" title="local:new.advanced.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">new.advanced.label</i18n:text></a>
  					<span> | </span>
  					<a href="../query/" title="local:link.home.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">link.home.label</i18n:text></a>
  				</p>
  				<table width="100%" class="query.history" summary="Query History">
  					<tr>
  						<th align="left"><i18n:text i18n:catalogue="local">history.date.label</i18n:text></th>
  						<th align="left"><i18n:text i18n:catalogue="local">history.title.label</i18n:text></th>
  						<th align="left"><i18n:text i18n:catalogue="local">history.query.label</i18n:text></th>
  						<th align="left"><i18n:text i18n:catalogue="local">history.hits.label</i18n:text></th>
  					</tr>
  					<jx:forEach var="item" items="${history}">
  						<tr valign="top">
  							<td class="history.date">
  								<jx:if test="${item.query.date != null}">
  									<jx:formatDate value="${item.query.date}" type="time"/>
  								</jx:if>
  							</td><td class="history.name">
  								${item.query.name}
  							</td><td class="query.description">
  								<i18n:text i18n:catalogue="local">search.subject.title</i18n:text>
  								<span class="query.bool" title="local:query.bool.hint" i18n:attr="title">
  									<i18n:text i18n:catalogue="local">search.${item.query.bool}.bool</i18n:text>
  								</span>
  								<span class="query.criteria">
  									<jx:choose>
  										<jx:when test="${item.query.criteria.size() == 1}">
  											<i18n:text i18n:catalogue="local">search.criterion.label</i18n:text>:
  										</jx:when>
  										<jx:otherwise>
  											<i18n:text i18n:catalogue="local">search.criteria.label</i18n:text>:
  										</jx:otherwise>
  									</jx:choose>
  								</span>
  								<ul class="query.criteria">
  									<jx:forEach var="crit" items="${item.query.criteria}">
  										<li>
  											<span class="query.criterion-field" title="local:criterion.field.hint" i18n:attr="title">
  												<i18n:text i18n:catalogue="local">search.${crit.field}.field</i18n:text>
  											</span>
  											<span class="query.criterion-match" title="local:criterion.match.hint" i18n:attr="title">
  												<i18n:text i18n:catalogue="local">search.${crit.match}.match</i18n:text>
  											</span>
  											<span class="query.criterion-value" title="local:criterion.value.hint" i18n:attr="title">“${crit.value}”</span>
  										</li>
  									</jx:forEach>
  								</ul>
  							</td><td class="query.hitcount">
  								${item.query.total}
  							</td><td>
  								<a href="${item.query.type}.html?id=${item.id}&amp;page=${item.query.page}" title="local:history.search.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">history.search.label</i18n:text></a>
  							</td><td>
  								<a href="${item.query.type}.html?id=${item.id}" title="local:history.edit.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">history.edit.label</i18n:text></a>
  							</td>
  						</tr>
  					</jx:forEach>
  				</table>
  			</jx:when>
  			<jx:otherwise>
  				<p class="history.queries-none"><i18n:text i18n:catalogue="local">history.none</i18n:text></p>
  			</jx:otherwise>
  		</jx:choose>
  	</content>
  </page>
  
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/screens/index.xml
  
  Index: index.xml
  ===================================================================
  <?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.
  -->
  
  <page>
  	<title>Query Bean Samples</title>
  	<content>
  		<p>
  			<b>NB. You need to make an index first.</b> <br/>
  			If you have not already made an index of the Cocoon Documentation, you may do so <a href="../document-files.xsp">here</a>.
  		</p>
  		
  		<h3>Search</h3>
  		<p>You can perform any of the following search types:</p>
  		<ul>
  			<li>Quick search: 
  				<form action="simple.html">
  					<input type="text" name="query" size="20" value="cocoon"/>
  					<input type="submit" value="Search" />
  				</form>
        </li>
  			<li><a href="simple.html">Simple</a> search: perform simple single-criteria searches.</li>
  			<li><a href="advanced.html">Advanced</a> search: perform complex multi-criteria searches.</li>
  		</ul>
  		
  		<h3>Queries</h3>
  		<p>You can view, reuse, and re-edit your previous queries:</p>
  		<ul>
  			<li><a href="history.html">History</a>: your search history.</li>
  		</ul>
  		<p>Or return to the <a href="../welcome">Lucene Samples</a></p>
  		
  		<h3>What it does.</h3>
  		<p>Allows you to assemble complex Lucene Queries without having to use the Lucene Query Language. Keeps a list of the queries you have performed in it's history (for as long as your Session lasts). Allows you to re-use and edit them.</p>
  		
  		<h3>How does it work?</h3>
  		<p>Through a combination of FlowScript (controller), CForms and JXTemplate (view), Beans (model), i18n and the CocoonLuceneSearcher component.</p>
  		<h4>FlowScript</h4>
  		The FlowScript controls the flow of the application, it instansiates Beans, manages the History, chooses which Forms and Screens to display, controls the CocoonLuceneSearcher.
  		<h4>CForms</h4>
  		<p>Cocoon Forms provideds the infrastructure to manipulate the Beans via HTML Forms. That is to change the Properties of the Beans and add and remove Criteria.</p>
  		<h4>JXTemplate</h4>
  		<p>
  			JXTemplate is used to show the results and the history (List of Query Beans).
  		</p><p>
  			The results are in the form of a <code>List</code> of <code>Map</code>s. Each Map represents a search hit. It contains the <code>url</code>, <code>score</code> and <code>rank</code> of the document, plus any Index Fields you arranged to have stored in your Index by Lucene (in this sample, the only stored field is the <code>title</code>).
  		</p><p>
  			The history is in the form of a <code>List</code> of Query Beans.
  		</p>
  		<h4>Beans</h4>
  		<p>The Beans represent an abstract (and potentially persistable) representation of your Query.</p>
  		<h4>i18n</h4>
  		<p>i18n is used to hold all of the display strings used by the Application. Form labels and hints, Query descriptions, Screen labels and hints, Error messages etc.</p>
  		<h4>CocoonLuceneSearcher</h4>
  		<p>This is the Component that does the actual searching. It is provided with the Lucene Directory and a Query by the Query Bean. If you give it a directory parameter that is a single folder name, it uses that folder in the Servlet Engine's Work Directory, if the parameter is an absolute file path, it uses that instead. It uses the default Analyser.</p>
  		
  		<h3>How to reuse this sample in your own projects?</h3>
  			<h4>Reuse the existing forms</h4>
  			<p>If you are happy with the existing forms, then all that really needs to happen to be able to re-use this sample in your own projects it to set up the menu of Search Fields, so they match your Search Index.</p>
  			<p>When the Lucene Index of Cocoon Documentation that this sample uses is created, tags within the documents are turned into Lucene Index Fields, which can be searched individually. The names of these fields are for example: <code>title</code>, <code>question</code>, <code>source</code>, <code>person@name</code> etc.</p>
  			<p>Cocoon Forms is setup to load these menus (selection-lists) from their own files. The <code>simple</code> search form uses the file <a href="screens/simple-fields.xml?cocoon-view=pretty-content">query/screens/simple-fields.xml</a>, while the <code>advanced</code> search form uses the file <a href="screens/advanced-fields.xml?cocoon-view=pretty-content">screens/advanced-fields.xml</a>.</p>
  			<p>Edit these files to match your own Search Index, for example, the item:
  				<pre><![CDATA[
  <fd:item value="title">
  	<fd:label><i18n:text i18n:catalogue="local">field.title.label</i18n:text></fd:label>
  </fd:item>
  ]]></pre>
  				makes a menu item using the i18n key <code>field.title.label</code> as the menu text and <code>title</code> as the value, where the value matches one of your Index Fields.
  			</p><p>
  				Once your CForms selection-lists are setup, you will want to edit the existing i18n message keys in <a href="screens/messages.xml?cocoon-view=pretty-content">screens/messages.xml</a> and/or provide new message files in your own language.
  			</p><p>
  				The last thing you may choose to do, is to supply some CSS for the screens. The <a href="screens/history.xml?cocoon-view=pretty-content">history</a> and <a href="screens/results.xml?cocoon-view=pretty-content">results</a> screens supply what is hopefully a rich enough
  collection of CSS Classes, have a look at the HTML output to see what there is.</p>
  
  			<h4>New Forms</h4>
  				<p>If you know CForms, it would be relatively easy to develop your own Forms (<a href="screens/advanced-model.xml?cocoon-view=pretty-content">Model</a>, <a href="screens/advanced-binding.xml?cocoon-view=pretty-content">Binding</a> and <a href="screens/advanced-template.xml?cocoon-view=pretty-content">Template</a>). If you follow the existing naming scheme and you choose a new name for your form, it may not even be necessary to edit the <a href="sitemap.xmap?cocoon-view=pretty-content">Sitemap</a>.
  				</p><p>Depending on how different your Forms are to the supplied ones, it may or may not be necessary to edit the FlowScript. It is quite possible that this will not be required.</p>
  			<h4>New Beans</h4>
  			<p>
  				It is possible to build Lucene Queries that are more complex, or specialised than those produced by these sample Beans. To do so you would have to at least implement your own CriterionBean. You would probably need to rewrite the FlowScript to handle your new Bean. 
  			</p>It would also be possible to implement different kinds of Queries, like those that used the Hibernate Criterion API.<p>
  			</p><p>
  				There are two Interfaces and two Bean Implementations of those Interfaces in the sample. <code>o.a.c.bean.query.SimpleLuceneQuery</code> and <code>o.a.c.bean.query.SimpleLuceneQueryBean</code> represent a Query, which has a Collection of <code>o.a.c.bean.query.SimpleLuceneCriterion</code> (<code>o.a.c.bean.query.SimpleLuceneCriterionBean</code>) Beans.
  			</p><p>
  				The <code>bool</code> property of the QueryBean specifies how the multiple criteria are combined. The <code>field</code> property of the CriterionBean specifies which Index Field to search, the <code>match</code> property specifies how to match that field and the <code>value</code> property, is the string from which Terms are extracted. All the rest is candy.
  			</p>
  			<h4>Persistance</h4>
  			<p>Both the Query and Criterion Beans were designed to be Persistable using one of the Object-Relational mapping tools like Hibernate, JDO, ORO etc. (This is why they have the unused <code>id</code> property).</p>
  	</content>
  </page>
  
  
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/screens/messages.xml
  
  Index: messages.xml
  ===================================================================
  <?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,v 1.1 2004/06/21 10:00:20 jeremy Exp $ -->
  <catalogue>
  
  	<!-- these keys are bound to your Index Field names -->
  	<!-- these keys are used for the Field Menu -->
    <message key="field.abstract.label">Document Abstract</message>
    <message key="field.answer.label">FAQ Answer</message>
    <message key="field.any.label">Any Document field</message>
    <message key="field.code.label">Document Code</message>
    <message key="field.link.label">Document Link</message>
    <message key="field.p.label">Document Paragraph</message>
    <message key="field.person@name.label">Author Name</message>
    <message key="field.question.label">FAQ Question </message>
    <message key="field.s1@title.label">Level 1 Section Title</message>
    <message key="field.s2@title.label">Level 2 Section Title</message>
    <message key="field.source.label">Sample Source Code</message>
    <message key="field.title.label">Document Title</message>
  
  	<!-- these keys are bound to your Index Field names -->
  	<!-- these keys are used to describe the queries -->
    <message key="search.abstract.field">document abstract</message>
    <message key="search.answer.field">faq answer</message>
    <message key="search.any.field">any field</message>
    <message key="search.code.field">document code</message>
    <message key="search.link.field">document link</message>
    <message key="search.p.field">document paragraph</message>
    <message key="search.person@name.field">author name</message>
    <message key="search.question.field">faq question</message>
    <message key="search.s1@title.field">section 1 title </message>
    <message key="search.s2@title.field">section 2 title</message>
    <message key="search.source.field">sample source</message>
    <message key="search.title.field">document title</message>
    
    <!-- advanced query -->
    <message key="advanced.criterion.label">Criterion</message>
    <message key="advanced.page.note">You can edit and save this query for later use.</message>
    <message key="advanced.page.title">An advanced query</message>
    <message key="advanced.query.label">Query</message>
  	<!-- cancel button -->
    <message key="cancel.hint">cancel this edit</message>
    <message key="cancel.label">Cancel</message>
  	<!-- editing criteria -->
    <message key="criterion.add.hint">add a new criterion</message>
    <message key="criterion.add.label">Add Criterion</message>
    <message key="criterion.delete.hint">delete this criterion</message>
    <message key="criterion.delete.label">-</message>
    <message key="criterion.field.hint">which fields to search in</message>
    <message key="criterion.field.label">Search Field</message>
    <message key="criterion.match.hint">the way your search term is matched</message>
    <message key="criterion.match.label">Match</message>
    <message key="criterion.value.hint">the word or words you are searching for</message>
    <message key="criterion.value.label">Word or Words</message>
  	<!-- displaying history -->
    <message key="history.date.label">Time</message>
    <message key="history.edit.hint">edit this query</message>
    <message key="history.edit.label">Edit</message>
    <message key="history.hits.label">Hits</message>
    <message key="history.none">No History</message>
    <message key="history.page.title">Query Bean : History</message>
    <message key="history.queries.title">Queries</message>
    <message key="history.query.label">Query</message>
    <message key="history.search.hint">re-search this query</message>
    <message key="history.search.label">Search</message>
    <message key="history.title.label">Title</message>
  	<!-- linking -->
    <message key="link.home.hint">the query bean samples home page</message>
    <message key="link.home.label">Home</message>
  	<!-- new queries -->
    <message key="new.advanced.hint">perform complex multi-criteria searches</message>
    <message key="new.advanced.label">New Advanced Query</message>
    <message key="new.simple.hint">perform simple single-criteria searches</message>
    <message key="new.simple.label">New Simple Query</message>
  	<!-- query paging -->
    <message key="paging.page.hint">the page to start from</message>
    <message key="paging.page.label">Page</message>
    <message key="paging.size.hint">how many hits per page</message>
    <message key="paging.size.label">Hits</message>
    <message key="paging.total.hint">how many hits this query gave last time it was used</message>
    <message key="paging.total.label">Results</message>
  	<!-- bool field -->
    <message key="query.bool.hint">the way your criteria match</message>
    <message key="query.bool.label">Search Criteria</message>
    <!-- name field -->
    <message key="query.name.hint">the name this query will have in the history</message>
    <message key="query.name.label">Query Name</message>
  	<!-- these keys are bound to values in the SimpleLuceneQuery -->
    <message key="search..bool">that match</message>
    <message key="search.and.bool">that match all of</message>
    <message key="search.or.bool">that match some of</message>
  	<!-- titles -->
    <message key="search.advanced.title">Advanced Query</message>
    <message key="search.edit.title">Edit this Query</message>
    <message key="search.favourites.title">Favourites</message>
    <message key="search.history.title">History</message>
    <message key="search.new.title">New Query</message>
    <message key="search.page.title">Query Bean</message>
    <message key="search.query.title">Query</message>
    <message key="search.section.title">Documents</message>
    <message key="search.simple.title">Simple Query</message>
    <message key="search.subject.title">Documents</message>
  	<!-- these keys are bound to values in the SimpleLuceneCriterion -->
    <message key="search.all.match">contains all words in</message>
    <message key="search.any.match">contains any word in</message>
    <message key="search.like.match">is somthing like</message>
    <message key="search.not.match">does not contain</message>
    <message key="search.phrase.match">contains the phrase</message>
  	<!-- labels -->
    <message key="search.criteria.label">these criteria</message>
    <message key="search.criterion.label">this criterion</message>
    <message key="search.next.label">next</message>
    <message key="search.pagecount.label">Number of pages</message>
    <message key="search.pagenumber.label">Page</message>
    <message key="search.pagesize.label">Hits per page</message>
    <message key="search.previous.label">previous</message>
    <message key="search.rank.label">Rank</message>
    <message key="search.recordcount.label">Total hits</message>
    <message key="search.score.label">Score</message>
    <message key="search.title.label">Title</message>
    <message key="search.uri.label">URI</message>
  	<!-- hints -->
    <message key="search.edit.hint">you can edit this Query or save it for future use</message>
    <message key="search.favourites.hint">view and edit your favourite queries</message>
    <message key="search.history.hint">view your search history</message>
    <message key="search.new.hint">create a new query of the same type as this one</message>
  	<!-- notes -->
    <message key="search.norecords.note">no results from your search, please try again</message>
    <message key="simple.page.note">Enter some words and hit submit.</message>
    <message key="simple.page.title">A simple query</message>
  	<message key="required.note">* required</message>
  	<!-- errors -->
    <message key="search.error.noquery">there was no query</message>
    <message key="search.error.nohistory">you have no history at the moment</message>
    <message key="search.error.noindex">You need to make a Lucene Index first (click <a href="../document-files.xsp">here</a> to make one)</message>
  	<!-- submit button -->
    <message key="submit.hint">save changes and search</message>
    <message key="submit.label">Submit</message>
  	
  </catalogue>
  
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/screens/results.xml
  
  Index: results.xml
  ===================================================================
  <?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,v 1.1 2004/06/21 10:00:20 jeremy Exp $ -->
  <page
  	xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
  	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
  	>
  	<title><i18n:text i18n:catalogue="local">${result.query.type}.page.title</i18n:text>: ${result.query.name}</title>
  	<content>
  		<!-- description of the query -->
  		<p class="query.description">
  			<i18n:text i18n:catalogue="local">search.subject.title</i18n:text>
  			<span class="query.bool" title="local:query.bool.hint" i18n:attr="title">
  				<i18n:text i18n:catalogue="local">search.${result.query.bool}.bool</i18n:text>
  			</span>
  			<span class="query.criteria">
  				<jx:choose>
  					<jx:when test="${result.query.criteria.size() == 1}">
  						<i18n:text i18n:catalogue="local">search.criterion.label</i18n:text>:
  					</jx:when>
  					<jx:otherwise>
  						<i18n:text i18n:catalogue="local">search.criteria.label</i18n:text>:
  					</jx:otherwise>
  				</jx:choose>
  			</span>
  			<ul class="query.criteria">
  				<jx:forEach var="item" items="${result.query.criteria}">
  					<li>
  						<span class="query.criterion-field" title="local:criterion.field.hint" i18n:attr="title">
  							<i18n:text i18n:catalogue="local">search.${item.field}.field</i18n:text>
  						</span>
  						<span class="query.criterion-match" title="local:criterion.match.hint" i18n:attr="title">
  							<i18n:text i18n:catalogue="local">search.${item.match}.match</i18n:text>
  						</span>
  						<span class="query.criterion-value" title="local:criterion.value.hint" i18n:attr="title">“${item.value}”.</span>
  					</li>
  				</jx:forEach>
  			</ul>
  		</p>
  		<!-- links -->
  		<p class="links">
  			<a href="${result.query.type}.html?id=${result.id}" title="local:search.edit.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">search.edit.title</i18n:text></a>
  			<span> | </span>
  			<a href="history.html" title="local:search.history.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">search.history.title</i18n:text></a>
  			<span> | </span>
  			<a href="simple.html" title="local:new.simple.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">new.simple.label</i18n:text></a>
  			<span> | </span>
  			<a href="advanced.html" title="local:new.advanced.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">new.advanced.label</i18n:text></a>
  			<span> | </span>
  			<a href="../query/" title="local:link.home.hint" i18n:attr="title"><i18n:text i18n:catalogue="local">link.home.label</i18n:text></a>
  		</p>
  		<!-- paging -->
  		<title><i18n:text i18n:catalogue="local">search.section.title</i18n:text></title>
  		<jx:choose>
  			<jx:when test="#{count(result/results) > 0}">
  				<jx:if test="#{count(result/nav/index) > 1}">
  					<div class="query.paging">
  						<p>
  							<span class="query.pagenumber"><i18n:text i18n:catalogue="local">search.pagenumber.label</i18n:text>: #{format-number(result/nav/page+1,'#')}.</span>
  							<span class="query.pagecount"><i18n:text i18n:catalogue="local">search.pagecount.label</i18n:text>: #{result/nav/pages}.</span>
  							<span class="query.hitcount"><i18n:text i18n:catalogue="local">search.recordcount.label</i18n:text>: #{result/nav/total}.</span>
  							<span class="query.pagesize"><i18n:text i18n:catalogue="local">search.pagesize.label</i18n:text>: #{result/nav/size}.</span>
  						</p>
  						<p class="query.navigation">
  							<jx:if test="#{result/nav/prev}">
  								<span class="query.prev">
  									<a href="${result.query.type}.html?page=#{result/nav/prev}&amp;id=${result.id}"><i18n:text i18n:catalogue="local">search.previous.label</i18n:text></a>&#160;
  								</span>
  							</jx:if>
  							<jx:if test="#{result/nav/firstIndex != 0}"><span class="query.prev-dots"> ... </span></jx:if>
  							<jx:set var="THIS" value="#{result/nav/page}"/>
  							<jx:forEach items="#{result/nav/index}">
  								<jx:choose>
  									<jx:when test="#{$THIS != .}"><span class="query.page-link"> <a href="${result.query.type}.html?page=#{.}&amp;id=${result.id}">#{format-number(.+1,'#')}</a> </span></jx:when>
  									<jx:otherwise><span class="query.this-page"> #{format-number(.+1,'#')} </span></jx:otherwise>
  								</jx:choose>
  							</jx:forEach>
  							<jx:if test="#{result/nav/lastIndex &lt; result/nav/pages - 1}"><span class="query.next-dots"> ... </span></jx:if>
  							<jx:if test="#{result/nav/next}">
  								<span class="query.next">
  									<a href="${result.query.type}.html?page=#{result/nav/next}&amp;id=${result.id}"><i18n:text i18n:catalogue="local">search.next.label</i18n:text></a>
  								</span>
  							</jx:if>
  						</p>
  					</div>
  				</jx:if>
  				<!-- results -->
  				<table class="query.results" summary="search results">
  					<tr>
  						<th align="left"><i18n:text i18n:catalogue="local">search.rank.label</i18n:text></th>
  						<th align="left"><i18n:text i18n:catalogue="local">search.score.label</i18n:text></th>
  						<th align="left"><i18n:text i18n:catalogue="local">search.title.label</i18n:text></th>
  					</tr>
  					<jx:forEach var="item" items="#{result/results}">
  						<jx:set var="score" value="${item[Packages.org.apache.cocoon.bean.query.SimpleLuceneQueryBean.SCORE_FIELD]}"/>
  						<jx:set var="index" value="${item[Packages.org.apache.cocoon.bean.query.SimpleLuceneQueryBean.INDEX_FIELD]}"/>
  						<jx:set var="url" value="${item[Packages.org.apache.cocoon.components.search.LuceneXMLIndexer.URL_FIELD]}"/>
  						<tr>
  							<td class="query.result-rank">#{format-number($index +1,'#')}</td>
  							<td class="query.result-score">#{format-number($score,'##%')}</td>
  							<td class="query.result-title"><a href="/docs/#{substring-before($url,'.xml')}.html"><jx:if test="#{string(title) = ''}"><span class="query.result-url">#{url}</span></jx:if>#{title}</a></td>
  						</tr>
  					</jx:forEach>
  				</table>
  			</jx:when>
  			<!-- no results -->
  			<jx:otherwise>
  				<p class="query.results-none"><i18n:text i18n:catalogue="local">search.norecords.note</i18n:text></p>
  			</jx:otherwise>
  		</jx:choose>
  	</content>
  </page>
  
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/screens/simple-binding.xml
  
  Index: simple-binding.xml
  ===================================================================
  <?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,v 1.1 2004/06/21 10:00:20 jeremy Exp $ -->
  <fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" path="/">
  	
    <fb:value id="name" path="name"/>
    <fb:value id="type" path="type"/>
    <fb:value id="bool" path="bool"/>
  
    <fb:value id="size" path="size"/>
    <fb:value id="page" path="page"/>
    <fb:value id="total" path="total"/>
  
    <fb:value id="value" path="criteria[1]/value"/>
    <fb:value id="field" path="criteria[1]/field"/>
    <fb:value id="match" path="criteria[1]/match"/>
  
  
  </fb:context>
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/screens/simple-fields.xml
  
  Index: simple-fields.xml
  ===================================================================
  <?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,v 1.1 2004/06/21 10:00:20 jeremy Exp $ -->
  
  <!-- 
  	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>
  
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/screens/simple-model.xml
  
  Index: simple-model.xml
  ===================================================================
  <?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,v 1.1 2004/06/21 10:00:20 jeremy Exp $ -->
  <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
  
    <fd:widgets>
  
      <fd:messages id="messages">
        <fd:label><i18n:text i18n:catalogue="local">message.label</i18n:text></fd:label>
      </fd:messages>
  
  		<fd:output id="id">
  			<fd:datatype base="string"/>
  		</fd:output>
  
  		<fd:field id="name" required="true">
  			<fd:label><i18n:text i18n:catalogue="local">query.name.label</i18n:text>: </fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">query.name.hint</i18n:text></fd:hint>
  			<fd:datatype base="string"/>
  		</fd:field>
  
  		<fd:output id="type">
  			<fd:datatype base="string"/>
  		</fd:output>
  
  		<fd:output id="bool">
  			<fd:datatype base="string"/>
  		</fd:output>
  
  		<fd:field id="size" required="true">
  			<fd:label><i18n:text i18n:catalogue="local">paging.size.label</i18n:text>: </fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">paging.size.hint</i18n:text></fd:hint>
  			<fd:datatype base="long"/>
  			<fd:selection-list>
  				<fd:item value="10"/>
  				<fd:item value="20"/>
  				<fd:item value="30"/>
  				<fd:item value="40"/>
  				<fd:item value="50"/>
  			</fd:selection-list>
  		</fd:field>
  
  		<fd:output id="page">
  			<fd:label><i18n:text i18n:catalogue="local">paging.page.label</i18n:text>: </fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">paging.page.hint</i18n:text></fd:hint>
  			<fd:datatype base="long"/>
  		</fd:output>
  
  		<fd:output id="total">
  			<fd:label><i18n:text i18n:catalogue="local">paging.total.label</i18n:text>: </fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">paging.total.hint</i18n:text></fd:hint>
  			<fd:datatype base="long"/>
  		</fd:output>
  
  		<fd:submit id="cancel" action-command="cancel" validate="false">
  			<fd:label><i18n:text i18n:catalogue="local">cancel.label</i18n:text></fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">cancel.hint</i18n:text></fd:hint>
  		</fd:submit> 
  
  		<fd:submit id="submit" action-command="submit" validate="true">
  			<fd:label><i18n:text i18n:catalogue="local">submit.label</i18n:text></fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">submit.hint</i18n:text></fd:hint>
  		</fd:submit> 
          
  		<fd:field id="value" required="true">
  			<fd:label><i18n:text i18n:catalogue="local">criterion.value.label</i18n:text>: </fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">criterion.value.hint</i18n:text></fd:hint>
  			<fd:datatype base="string"/>
  		</fd:field>
  		
  		<fd:field id="field" required="true">
  			<fd:label><i18n:text i18n:catalogue="local">criterion.field.label</i18n:text>: </fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">criterion.field.hint</i18n:text></fd:hint>
  			<fd:datatype base="string">
  				<fd:validation>
  					<fd:length min="2" max="64"/>
  				</fd:validation>
  			</fd:datatype>
  			<fd:selection-list src="screens/simple-fields.xml"/>
  		</fd:field>
  
  		<fd:output id="match">
  			<fd:label><i18n:text i18n:catalogue="local">criterion.match.label</i18n:text>: </fd:label>
  			<fd:hint><i18n:text i18n:catalogue="local">criterion.match.hint</i18n:text></fd:hint>
  			<fd:datatype base="string"/>
  		</fd:output>
  	
    </fd:widgets>
  </fd:form>
  
  
  1.1                  cocoon-2.1/src/blocks/lucene/samples/query/screens/simple-template.xml
  
  Index: simple-template.xml
  ===================================================================
  <?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,v 1.1 2004/06/21 10:00:20 jeremy Exp $ -->
  <page 
  	xmlns:ft="http://apache.org/cocoon/forms/1.0#template" 
  	xmlns:fi="http://apache.org/cocoon/forms/1.0#instance" 
  	xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
  >
  	<title>
  		<i18n:text i18n:catalogue="local">search.page.title</i18n:text> : <i18n:text i18n:catalogue="local">simple.page.title</i18n:text>
  	</title>
  	<content>
  		<p><i18n:text i18n:catalogue="local">simple.page.note</i18n:text></p>
  		<ft:form-template action="" method="POST">
  			<ft:continuation-id/>
  			<p class="woody-message"><ft:widget id="messages"/></p>
  			<fi:group>
  				<fi:styling layout="columns"/>
  				<fi:hint>editor layout</fi:hint>
  				<fi:items>
  					<ft:widget id="field"/>
  					<ft:widget id="value"/>
  					<hr/>
  					<ft:widget id="name"/>
  					<ft:widget id="size"/>
  					<hr/>
  				</fi:items>
  			</fi:group>
  			<i18n:text i18n:catalogue="local">required.note</i18n:text>
  			<ft:widget id="cancel"/>
  			<ft:widget id="submit"/>
  		</ft:form-template>
  	</content>
  </page>
  
  
  1.4       +21 -4     cocoon-2.1/src/blocks/lucene/samples/stylesheets/content2lucene.xsl
  
  Index: content2lucene.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/lucene/samples/stylesheets/content2lucene.xsl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- content2lucene.xsl	5 Apr 2004 12:25:31 -0000	1.3
  +++ content2lucene.xsl	21 Jun 2004 10:00:22 -0000	1.4
  @@ -36,10 +36,27 @@
     <xsl:template match="file">
       <lucene:document>
         <xsl:attribute name="url"><xsl:value-of select="name"/></xsl:attribute>
  -      <xsl:copy-of select="include/*"/>
  +      <xsl:apply-templates select="include/*"/>
       </lucene:document>
     </xsl:template>
  -
  -  <xsl:template match="@*|node()" priority="-1"></xsl:template>
  -  <xsl:template match="text()" priority="-1"></xsl:template>
  +  
  +	<!-- store main titles -->
  +	<xsl:template match="page/title|header/title">
  +		<title lucene:store="true"><xsl:apply-templates/></title>
  +	</xsl:template>
  +	
  +	<xsl:template match="faqs[@title]|book[@title]">
  +		<xsl:copy>
  +			<xsl:apply-templates select="@*[local-name() != 'title']"/>
  +			<title lucene:store="true"><xsl:value-of select="@title"/></title>
  +			<xsl:apply-templates/>
  +		</xsl:copy>
  +	</xsl:template>
  +	
  +	<xsl:template match="path"></xsl:template>
  +	
  +  <xsl:template match="@*|node()" priority="-2"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template>
  +  <xsl:template match="text()" priority="-1"><xsl:value-of select="."/></xsl:template>
  +  
  +  
   </xsl:stylesheet> 
  
  
  
  1.4       +1 -0      cocoon-2.1/src/blocks/lucene/samples/stylesheets/search-index2html.xsl
  
  Index: search-index2html.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/lucene/samples/stylesheets/search-index2html.xsl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- search-index2html.xsl	5 Apr 2004 12:25:31 -0000	1.3
  +++ search-index2html.xsl	21 Jun 2004 10:00:22 -0000	1.4
  @@ -151,6 +151,7 @@
             <xsl:value-of select="@uri"/>
           </a>
         </td>
  +      <td><xsl:value-of select="search:field[@name='title']"/></td>
       </tr>
     </xsl:template>
   
  
  
  
  1.9       +2 -2      cocoon-2.1/src/java/org/apache/cocoon/components/ContextHelper.java
  
  Index: ContextHelper.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/ContextHelper.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ContextHelper.java	26 May 2004 08:39:49 -0000	1.8
  +++ ContextHelper.java	21 Jun 2004 10:00:23 -0000	1.9
  @@ -34,7 +34,7 @@
    */
   
   public final class ContextHelper {
  -
  +		
       /** Application <code>Context</code> Key for the current object model */
       public static final String CONTEXT_OBJECT_MODEL = "object-model";