cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martijn C. Vos" <>
Subject RE: Help me please!
Date Thu, 15 Dec 2005 12:30:13 GMT

Dan Nicolici [] wrote:
>  Thank you very much, Martijn, for the example!
>  I still have some questions if you don't mind :)
>  The example again:
>  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>  <map:match pattern="*/lucene-index.xml">
>    <map:generate src="cocoon:/listing/{1}"/>
>    <map:transform
>  src="../stylesheets/templates/lucene/create-lucene-index.xsl">
>      <map:parameter name="realpath" value="{realpath:/}"/>
>      <map:parameter name="languageId" value="{1}"/>
>    </map:transform>   
>    <map:serialize type="xml"/>
>  </map:match>
>  <map:match pattern="listing/*">
>    <map:generate type="xpathdirectory" src="{constants:datapath}/{1}">
>      <map:parameter name="depth" value="2"/>
>      <map:parameter name="xpath" value="."/>
>      <map:parameter name="xmlFiles" value=".xml"/>
>    </map:generate>
>    <map:serialize type="xml"/>
>  </map:match>
>  <map:match pattern="*/lucene-create">
>    <map:generate src="cocoon:/{1}/lucene-index.xml"/>
>    <map:transform type="index"/>
>    <map:serialize type="xml"/>
>  </map:match>
>  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>  Please bear with me a little further. Let's see if I got this right:
>  1. I (or a cron job) call the "*/lucene-create" pipeline;
>  2. That pipeline calls the "*/lucene-index.xml" pipeline;
>  3. Here is where the "listing/*" pipeline gets called;
>  	3.1. Here I guess all my other app-relevant pipelines should get
>  called to issue their xml results. I see that you used the
>  XPathDirectoryGenerator (not quite familiar with this...). 
>  Does it generate
>  content from static files?

It does. If you want to index stuff from a database or from
something else, you have to generate that as xml. So basically
what happens is:

<map:generate src="cocoon:/all-the-stuff-you-want-to-index"/>
<map:transform src="turn-it-into-something-the-indexer-understands.xsl"/>
<map:transform type="index"/>
<map:serialize type="xml"/>

>  4. Create the "lucene:index" document from previous results.
>  5. Apply LuceneIndexTransformer on the "lucene:index" document.
>  The search is pretty straightforward.
>  Can you please insist a little on the step at 3.1?

What more do you want to know about it?

>  Can I take a quick glance at "create-lucene-index.xsl"?

Basically it's:

<xsl:template match="/">

<xsl:template match="dir:file">
    <xsl:attribute name="url">
      <xsl:value-of select="concat(../@name, '/', @name)"/>
<xsl:template match="document">
  <xsl:apply-templates mode="store"/>
<xsl:template match="*" mode="store">
  <xsl:element name="{name()}">
    <xsl:attribute name="lucene:store">true</xsl:attribute>
      <xsl:apply-templates mode="store"/>

It turns the results from xpathdirectory into suitable input for the
lucene indexer. But all of this was written by someone else, I don't
know much beyond this about these two components.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message