cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Sparkes <pe...@didm.co.uk>
Subject Re: Completely lost with Lucene
Date Sun, 04 Jun 2006 23:20:01 GMT
Question 1

Rank 0 means it is the hit with the highest score
Rank 1 means it is the hit with the second highest score
etc
If there is only one hit it is always rank 0

Question 2
Have a look at the cocoon 2.1.9 Luvene sample.
If you want to search for "foo" in "title" your search string should be 
"title:foo"

Question 3

Try

<map:match pattern="search.htm">
      <map:generate type="search">
             <map:parameter name="index" value="luceneindex"/>
       </map:generate>
        <map:transform type="log"/>
        <map:serialize type="xml"/>              <!--Look at the 
resulting xml and write your lucene.xslt to give you what you want-->
        <map:transform src="stylesheets/lucene.xslt"/>
         <map:serialize/>
   </map:match>

Peter


> Hello again,
>
> 3 further questions
>
> - is there any documentation on how Lucene calculates the rank score?
> - 'rank' always starts with 0. How can I make it start with 1 ?
>
> - let's say, my input document is like that:
>
> <lucene:document url="http://google.com">
>                <title lucene:store="true" >Linktext</title>
> </lucene:document>
>
>
> how can I afterwards access the value of 'title'?
>
>
> <xsl:template match="search:hit" >
> <a target="_blank" href="{@uri}">
>           <xsl:value-of select="uri"/>   <--instead, I want the value 
> of the stored title tag, in this case 'Linktext'
> </a>
> </xsl:template>
>
>The doc (http://cocoon.apache.org/2.1/userdocs/concepts/xmlsearching.html) says
><xsl:value-of select="search:field[@search:name='title']"/> , but that doesn't work.
>
>
>Any ideas? 
>Thank you very much
>Marco
>
>  
>
>
>
> 2006/6/2, 321los@gmail.com <mailto:321los@gmail.com> <321los@gmail.com 
> <mailto:321los@gmail.com>>:
>
>     Thank you very much Peter. The problem is solved
>
>
>     2006/6/2, Peter Sparkes <peter@didm.co.uk <mailto:peter@didm.co.uk>>:
>
>         Hi,
>
>         Suggest use the LuceneIndexTransformer as follows:
>
>         <map:match pattern="buildIndex">
>               <map:generate src="karte.xml"/>
>                  <map:transform type="index"/>
>                  <map:serialize type="xml"/>
>         </map:match>
>
>         <map:match pattern="karte.xml">
>            Generate a single file that contains all the data that you want
>         indexed as in section "Input document for the
>         LuceneIndexTransformer" in
>         http://wiki.apache.org/cocoon/LuceneIndexTransformer
>             <map:serialize type="xml"/>
>         </map:match>
>
>         Peter
>
>> Hi,
>>
>> I'd like to use the Lucene search in my page, but reading the
>         docs at
>> http://cocoon.apache.org/2.1/userdocs/concepts/xmlsearching.html
>         <http://cocoon.apache.org/2.1/userdocs/concepts/xmlsearching.html>
>         and
>> http://wiki.apache.org/cocoon/LuceneIndexTransformer does not
>         really
>> enlighten me.
>>
>> My case:
>> The content of my pages is generated dynamically, getting the
>         data
>> from a mysql database. Something like that,
>>
>> <map:match pattern="karte">
>>     <map:generate type="file" src="documents/xml/sql.xml"/>
>>     <map:transform type="sql">
>>         <map:parameter name="use-connection" value="mysql-pool"/>
>>         <map:parameter name="lfdnr"
>         value="{request-param:lfdnr}"/>
>>      </map:transform>
>>      <map:transform src="documents/stylesheets/style.xsl"/>
>>      <map:serialize type="html"/>
>> </map:match>
>>
>> So calling e.g. the address
>> http://localhost:8080/cocoon/karte?lfdnr=412 shows me the
>         results of
>> the page with the sql primary key 412 transformed via style.xsl.
>>
>> Lucene should be able to index the columns 'lfd_nr', 'venue' and
>> 'description' (without indexing the other 6 columns of the
>         table) and
>> should give me the results, if those fields match my search query
>> obviously, like shown above (
>> http://localhost:8080/cocoon/karte?lfdnr='pk
>         <http://localhost:8080/cocoon/karte?lfdnr=%27pk>'
>> <http://localhost:8080/cocoon/karte?lfdnr=%27pk%27
>         <http://localhost:8080/cocoon/karte?lfdnr=%27pk%27>>)
>>
>> Declaring the LuceneIndexTransformer of my sitemap is the
>         only thing I
>> have completely understood from the wiki. ;)
>> A little guidance would be appreciated very much. (+ what to
>         write in
>> which files, since that does not always emanate from the wiki)
>>
>> Thanks in advance
>> Marco
>
>
>         ---------------------------------------------------------------------
>         To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>         <mailto:users-unsubscribe@cocoon.apache.org>
>         For additional commands, e-mail: users-help@cocoon.apache.org
>         <mailto:users-help@cocoon.apache.org>
>
>
>

Mime
View raw message