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 2002/11/23 15:11:25 UTC
cvs commit: xml-cocoon2/src/java/org/apache/cocoon/generation SearchGenerator.java
jeremy 2002/11/23 06:11:25
Modified: src/java/org/apache/cocoon/generation SearchGenerator.java
Log:
updated to optionally take the query string from a sitemap parameter 'query'.
Revision Changes Path
1.10 +22 -7 xml-cocoon2/src/java/org/apache/cocoon/generation/SearchGenerator.java
Index: SearchGenerator.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/SearchGenerator.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SearchGenerator.java 6 Sep 2002 03:35:54 -0000 1.9
+++ SearchGenerator.java 23 Nov 2002 14:11:25 -0000 1.10
@@ -93,6 +93,8 @@
* The generated xml content contains the search result,
* the search query information, and navigation information about the
* search results.
+ * The query is sent to the generator, either via the 'queryString' request parameter
+ * or the 'query' SiteMap parameter. The sitemap overides the request.
* </p>
*
* <p>
@@ -125,6 +127,7 @@
*
* @author <a href="mailto:berni_huber@a1.net">Bernhard Huber</a>
* @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
+ * @author <a href="mailto:jeremy@apache.org">Jeremy Quinn</a>
* @version CVS $Id$
*/
public class SearchGenerator extends ComposerGenerator
@@ -274,6 +277,12 @@
protected final static String INDEX_PARAM_DEFAULT = "index";
/**
+ * Setup the actual query from generator parameter,
+ * ie <code>query</code>.
+ */
+ protected final static String QUERY_PARAM = "query";
+
+ /**
* Setup parameter name specifying the name of query-string query parameter,
* ie <code>query-string</code>.
*/
@@ -427,13 +436,19 @@
index = new File(workDir, index.toString());
}
- // get queryString
+ // try getting the queryString from the generator sitemap params
+
+ queryString = "";
+ queryString = par.getParameter(QUERY_PARAM, "");
+
+ // try getting the queryString from the request params
+ if (queryString.equals("")) {
+ param_name = par.getParameter(QUERY_STRING_PARAM, QUERY_STRING_PARAM_DEFAULT);
+ if (request.getParameter(param_name) != null) {
+ queryString = request.getParameter(param_name);
+ }
+ }
// always try lookup the start index from the request params
- param_name = par.getParameter(QUERY_STRING_PARAM, QUERY_STRING_PARAM_DEFAULT);
- if (request.getParameter(param_name) != null) {
- queryString = request.getParameter(param_name);
- }
-
// get startIndex
startIndex = null;
param_name = par.getParameter(START_INDEX_NEXT_PARAM, START_INDEX_NEXT_PARAM_DEFAULT);
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org