cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r554235 - in /cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF: ./ stylesheets/
Date Sat, 07 Jul 2007 18:11:35 GMT
Author: felixk
Date: Sat Jul  7 11:11:34 2007
New Revision: 554235

URL: http://svn.apache.org/viewvc?view=rev&rev=554235
Log:
Adapt sample to springified block impl

Added:
    cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/create-index2.jx
  (with props)
Modified:
    cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/flow.js
    cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/sitemap.xmap
    cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/lucene-index2html.xsl
    cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/search-index2html.xsl
    cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/search2html.xsl
    cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/welcome-index.xml

Added: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/create-index2.jx
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/create-index2.jx?view=auto&rev=554235
==============================================================================
--- cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/create-index2.jx
(added)
+++ cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/create-index2.jx
Sat Jul  7 11:11:34 2007
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+<!-- @version $Id$ -->
+<page>
+    <content>
+      <h1>Create a Lucene search index</h1>
+      <para>
+        <font size="-1">
+          <a href="welcome">Welcome</a>
+        </font>
+      </para>
+      <para>
+        This process might take some time (follow the tail of your logfiles
+        to see the indexer in progress).
+        <ul>
+          <li>LuceneCocoonIndexer.ROLE org.apache.cocoon.components.search.LuceneCocoonIndexer
+          </li>
+          <li>context-path ${cocoon.request.getContextPath()}
+          </li>
+          <li>baseURL ${url}
+          </li>
+          <li>create ${cocoon.request.getParameter("create")}, ${create}
+          </li>
+          <li>get-uri ${cocoon.request.getRequestURI()}
+          </li>
+          <li>get-sitemap-uri ${cocoon.request.getSitemapURI()}
+          </li>
+        </ul>
+
+        <form action="create2">
+        <table>
+          <tr>
+            <td>BaseURL</td>
+            <td>
+              <input type="text" name="baseURL" size="60" value="${url}"/>
+            </td>
+          </tr>
+          <tr>
+            <td colspan="2">
+              <input type="radio" name="create" value="true" checked="checked"/>
+              Create/Overwrite the Index, or
+              <input type="radio" name="create" value="false"/>
+              Update the existing Index
+            </td>
+          </tr>
+          <tr>
+            <td colspan="2">
+              <input type="submit" name="find" value="Create"/>
+            </td>
+          </tr>
+        </table>
+        </form>
+
+      </para>
+    </content>
+</page>

Propchange: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/create-index2.jx
------------------------------------------------------------------------------
    svn:eol-style = Id

Propchange: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/create-index2.jx
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/flow.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/flow.js?view=diff&rev=554235&r1=554234&r2=554235
==============================================================================
--- cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/flow.js
(original)
+++ cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/flow.js
Sat Jul  7 11:11:34 2007
@@ -28,14 +28,37 @@
       
     var baseURL = cocoon.request.getParameter("baseURL");
     if (baseURL != null && baseURL.length() > 0) {
-        var util = cocoon.createObject("org.apache.cocoon.samples.LuceneUtil");
+        var util = cocoon.getComponent("org.apache.cocoon.samples.LuceneUtil");
         util.createIndex(baseURL, create );
     }
     if (baseURL == null || baseURL.length() < 1) {
         baseURL = "http://" + cocoon.request.getServerName()
                             + ":" + cocoon.request.getServerPort()
                             + cocoon.request.getContextPath()
-                            + "/docs/index.html";
+                            + "/cocoon-lucene-sample/welcome";
     }
     cocoon.sendPage("create-index.jx", {"url" : baseURL, "create" : create});
+}
+
+function create2() {
+    var create;
+    var createParam = cocoon.request.getParameter("create");
+    if (createParam == null) {
+        create = false;
+    } else {
+        create = true;
+    }
+      
+    var baseURL = cocoon.request.getParameter("baseURL");
+    if (baseURL != null && baseURL.length() > 0) {
+        var util = cocoon.getComponent("org.apache.cocoon.samples.LuceneUtil");
+        util.createIndex2(baseURL, create );
+    }
+    if (baseURL == null || baseURL.length() < 1) {
+        baseURL = "http://" + cocoon.request.getServerName()
+                            + ":" + cocoon.request.getServerPort()
+                            + cocoon.request.getContextPath()
+                            + "/cocoon-core-main-sample/";
+    }
+    cocoon.sendPage("create-index2.jx", {"url" : baseURL, "create" : create});
 }

Modified: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/sitemap.xmap?view=diff&rev=554235&r1=554234&r2=554235
==============================================================================
--- cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/sitemap.xmap
(original)
+++ cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/sitemap.xmap
Sat Jul  7 11:11:34 2007
@@ -24,9 +24,6 @@
 
     <!-- =========================== Generators ================================ -->
 
-    <map:generators default="file">
-      <map:generator name="search" logger="sitemap.generator.search" label="content" src="org.apache.cocoon.generation.SearchGenerator"
/>
-    </map:generators>
     <map:transformers default="xslt">
       <map:transformer name="index" logger="sitemap.transformer.luceneindextransformer"
src="org.apache.cocoon.transformation.LuceneIndexTransformer" />
     </map:transformers>
@@ -76,6 +73,10 @@
         <map:redirect-to uri="welcome" />
       </map:match>
 
+      <map:match pattern="sitemap.xmap">
+        <map:read src="sitemap.xmap" mime-type="text/xml" />
+      </map:match>
+
       <!-- mount query bean pipelines
         <map:match pattern="query/**">
         <map:mount src="query/sitemap.xmap" uri-prefix="query"/>
@@ -89,7 +90,7 @@
       </map:match>
 
       <map:match pattern="findIt">
-        <map:generate type="search" />
+        <map:generate type="lucene-search" />
         <map:transform type="log" />
         <map:transform src="stylesheets/search2html.xsl" />
         <map:transform type="servletLinkRewriter" />
@@ -97,7 +98,7 @@
       </map:match>
 
       <map:match pattern="findIt2">
-        <map:generate type="search">
+        <map:generate type="lucene-search">
           <map:parameter name="index" value="index2" />
         </map:generate>
         <map:transform type="log" />
@@ -120,6 +121,18 @@
 
       <map:match pattern="create-index.jx">
         <map:generate type="jx" src="create-index.jx" />
+        <!-- Make use of servlet services -->
+        <map:serialize type="servletService">
+          <map:parameter name="service" value="servlet:style-default:/service/blocks/dynamic-page2html"
/>
+        </map:serialize>
+      </map:match>
+
+      <map:match pattern="create2">
+        <map:call function="create2" />
+      </map:match>
+
+      <map:match pattern="create-index2.jx">
+        <map:generate type="jx" src="create-index2.jx" />
         <!-- Make use of servlet services -->
         <map:serialize type="servletService">
           <map:parameter name="service" value="servlet:style-default:/service/blocks/dynamic-page2html"
/>

Modified: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/lucene-index2html.xsl
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/lucene-index2html.xsl?view=diff&rev=554235&r1=554234&r2=554235
==============================================================================
--- cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/lucene-index2html.xsl
(original)
+++ cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/lucene-index2html.xsl
Sat Jul  7 11:11:34 2007
@@ -29,7 +29,7 @@
         <link title="Default Style" href="servlet:style-default:/styles/main.css" rel="stylesheet"/>
       </head>
       <body >
-        <a href="http://jakarta.apache.org/lucene/">
+        <a href="http://lucene.apache.org/">
           <img border="0" alt="Lucene Logo" src="images/lucene_green_300.gif"/>
         </a>
         <h1>Lucene-Index</h1>

Modified: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/search-index2html.xsl
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/search-index2html.xsl?view=diff&rev=554235&r1=554234&r2=554235
==============================================================================
--- cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/search-index2html.xsl
(original)
+++ cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/search-index2html.xsl
Sat Jul  7 11:11:34 2007
@@ -25,19 +25,19 @@
   <xsl:template match="search:results">
     <html>
       <head>
-        <title>Index2 Search</title>
+        <title>Index Search</title>
         <link title="Default Style" href="servlet:style-default:/styles/main.css" rel="stylesheet"/>
       </head>
       <body bgcolor="white" alink="red" link="blue" vlink="blue">
-        <a href="http://jakarta.apache.org/lucene/">
+        <a href="http://lucene.apache.org/">
           <img border="0" alt="Lucene Logo" src="images/lucene_green_300.gif"/>
         </a>
-        <h1>Index2Search</h1>
+        <h1>IndexSearch</h1>
         
         <p>
           <small>
             <a href="welcome">Welcome</a> |
-            <a href="statistic?indexName=index2">Index2 Statistic</a>
+            <a href="statistic">Index Statistic</a>
           </small>
         </p>
         
@@ -146,13 +146,10 @@
         <xsl:value-of select="@rank"/>
       </td>
       <td>
-        <xsl:variable name="pure-name" select="substring-before(@uri,'.xml')"/>
-        <a target="_blank">
-          <xsl:attribute name="href">/docs/<xsl:value-of select="$pure-name"/>.html</xsl:attribute>
+        <a target="_blank" href="{@uri}">
           <xsl:value-of select="@uri"/>
         </a>
       </td>
-      <td><xsl:value-of select="search:field[@name='title']"/></td>
     </tr>
   </xsl:template>
 

Modified: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/search2html.xsl
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/search2html.xsl?view=diff&rev=554235&r1=554234&r2=554235
==============================================================================
--- cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/search2html.xsl
(original)
+++ cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/stylesheets/search2html.xsl
Sat Jul  7 11:11:34 2007
@@ -29,7 +29,7 @@
         <link title="Default Style" href="servlet:style-default:/styles/main.css" rel="stylesheet"/>
       </head>
       <body bgcolor="white" alink="red" link="blue" vlink="blue">
-        <a href="http://jakarta.apache.org/lucene/">
+        <a href="http://lucene.apache.org/">
           <img border="0" alt="Lucene Logo" src="images/lucene_green_300.gif"/>
         </a>
         <h1>IndexSearch</h1>

Modified: cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/welcome-index.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/welcome-index.xml?view=diff&rev=554235&r1=554234&r2=554235
==============================================================================
--- cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/welcome-index.xml
(original)
+++ cocoon/trunk/blocks/cocoon-lucene/cocoon-lucene-sample/src/main/resources/COB-INF/welcome-index.xml
Sat Jul  7 11:11:34 2007
@@ -19,7 +19,7 @@
 <page>
     <title>Welcome to Cocoon XML Search using Lucene</title>
     <content>
-      <a href="http://jakarta.apache.org/lucene/"><img border="0" alt="Lucene Logo"
src="images/lucene_green_300.gif"/></a>
+      <a href="http://lucene.apache.org/"><img border="0" alt="Lucene Logo" src="images/lucene_green_300.gif"/></a>
       
       <h1>XML Search</h1>
       
@@ -48,16 +48,31 @@
         Create an index by specifying a base url from which to start
         crawling (the indexer will follow the links to build its content).
         The base url should be 
-        <a href="../../../docs/userdocs/concepts/views.html">cocoon-view</a>
+        <a href="http://cocoon.apache.org/2.1/userdocs/concepts/views.html">cocoon-view</a>
         aware of content-labels
         <strong>links</strong>, and <strong>content</strong>.
         For example you might use the base URL 
-        <code>http://localhost:8888/docs/index.html</code>
+        <code>http://localhost:8888/blocks/cocoon-lucene-sample/welcome</code>
       </p>
       <p>
         This following page allows you to <a href="create">create</a> an
         index, named index.
       </p>
+      <br />
+      <p>
+        Create an index by specifying a base url from which to start
+        crawling (the indexer will follow the links to build its content).
+        The base url should be 
+        <a href="http://cocoon.apache.org/2.1/userdocs/concepts/views.html">cocoon-view</a>
+        aware of content-labels
+        <strong>links</strong>, and <strong>content</strong>.
+        For example you might use the base URL 
+        <code>http://localhost:8888/blocks/cocoon-core-main-sample/</code>
+      </p>
+      <p>
+        This following page allows you to <a href="create2">create2</a> an
+        index, named index2.
+      </p>
 
       <h2>Searching</h2>
       <p>
@@ -87,10 +102,10 @@
       <h2>Internals</h2>
       <p>
         Cocoon XML search uses the
-        <a href="http://jakarta.apache.org/lucene/">Jakarta Lucene</a>
+        <a href="http://lucene.apache.org/">Apache Lucene</a>
         indexing and search engine.
         The Cocoon documentation
-        <a href="../../../docs/userdocs/concepts/xmlsearching.html">explains</a>
how it is implemented within Cocoon. Look behind the scenes of this
+        <a href="http://cocoon.apache.org/2.1/userdocs/concepts/xmlsearching.html">explains</a>
how it is implemented within Cocoon. Look behind the scenes of this
         example to find out more.
       </p>
 



Mime
View raw message