cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jer...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/lucene/samples/query query.js sitemap.xmap
Date Wed, 23 Jun 2004 10:50:50 GMT
jeremy      2004/06/23 03:50:50

  Modified:    src/blocks/lucene/samples/query query.js sitemap.xmap
  Log:
  made it easier to construct a simple query from a URL or sitemap, by adding "match" and
"field" parameters
  
  Revision  Changes    Path
  1.2       +6 -4      cocoon-2.1/src/blocks/lucene/samples/query/query.js
  
  Index: query.js
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/lucene/samples/query/query.js,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- query.js	21 Jun 2004 10:00:20 -0000	1.1
  +++ query.js	23 Jun 2004 10:50:50 -0000	1.2
  @@ -49,18 +49,20 @@
   	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 ();
  +	var page = null;
  +	var match = "".equals (cocoon.parameters["match"]) ? SimpleLuceneCriterion.ANY_MATCH :
cocoon.parameters["match"];
  +	var field = "".equals (cocoon.parameters["field"]) ? SimpleLuceneCriterion.ANY_FIELD :
cocoon.parameters["field"];
   	try {
   		if ( !"".equals (cocoon.parameters["page"]) ) page = new java.lang.Long (cocoon.parameters["page"]);
   		if ( !"".equals (cocoon.parameters["query"]) ) { // test for: quick ?query
  -			query = new SimpleLuceneQueryBean (type, null, SimpleLuceneCriterion.ANY_MATCH, SimpleLuceneCriterion.ANY_FIELD,
cocoon.parameters["query"]);
  +			query = new SimpleLuceneQueryBean (type, null, match, field, cocoon.parameters["query"]);
   		} else if ( "".equals (historyid) ) {            // test for: new query
  -			query = new SimpleLuceneQueryBean (type, null, SimpleLuceneCriterion.ANY_MATCH, SimpleLuceneCriterion.ANY_FIELD,
"");
  +			query = new SimpleLuceneQueryBean (type, null, match, field, "");
   			edit (query);
   		} else {
   			try {
  
  
  
  1.2       +4 -2      cocoon-2.1/src/blocks/lucene/samples/query/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/lucene/samples/query/sitemap.xmap,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sitemap.xmap	21 Jun 2004 10:00:20 -0000	1.1
  +++ sitemap.xmap	23 Jun 2004 10:50:50 -0000	1.2
  @@ -1,4 +1,4 @@
  -<?xml version="1.0"?>
  +<?xml version="1.0" encoding="utf-8"?>
   <!--
     Copyright 1999-2004 The Apache Software Foundation
   
  @@ -130,9 +130,11 @@
   					<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:parameter name="query" value="{request-param:query}"/> 						<!-- the
query param (for quick queries) -->
  +					<map:parameter name="match" value="{request-param:match}"/> 						<!-- the
match param (for quick queries) -->
  +					<map:parameter name="field" value="{request-param:field}"/> 						<!-- the
field param (for quick queries) -->
   				</map:call>
   			</map:match>
   
  
  
  

Mime
View raw message