You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stephen Winnall <st...@winnall.ch> on 2006/06/27 12:42:02 UTC

searching with Lucene in bilingual Cocoon site

I'm implementing a bilingual website using Cocoon 2.1.8. I want a  
search facility, so
I'm trying to use the Lucene block to implement it. Since the two  
languages (English
and German) have different stop lists, stemming rules etc., and any  
given word may
have a different meaning depending on the language, it seems to me  
appropriate
to have two separate indices.

The following extracts from my sitemap show how I have tried to solve  
this:

<map:components>

     ....

     <map:generators>

         ....

         <map:generator name="search-de"  
src="org.apache.cocoon.generation.SearchGenerator">
             <index>search/de</index>
             <analyzer>org.apache.lucene.analysis.de.GermanAnalyzer </ 
analyzer>
         </map:generator>

         <map:generator name="search-en"  
src="org.apache.cocoon.generation.SearchGenerator">
             <index>search/en</index>
              
<analyzer>org.apache.lucene.analysis.standard.StandardAnalyzer</ 
analyzer>
         </map:generator>

         ....

     </map:generators>

     ....

</map:components>

<map:pipelines>

     ....

     <map:pipeline>

         ....

         <map:match pattern="search">
             <map:act type="locale">
                 <map:select type="parameter">
                     <map:parameter name="parameter-selector-test"  
value="{language}" />
                     <map:when test="de">
                         <map:generate type="search-de" />
                     </map:when>
                     <map:otherwise>
                         <map:generate type="search-en" />
                     </map:otherwise>
                 </map:select>
             </map:act>
             <map:serialize type="xml" />
         </map:match>

         ....

     </map:pipeline>

     ....

</map:pipelines>


However, when I invoke the URI /search I get the following error from  
Jetty:

     java.io.IOException: /private/tmp/Jetty__8888__/cocoon-files/ 
index not a directory

Apparently Cocoon is ignoring the <index> entry in the  
<map:generator> element, where
I specified "search/de" for German and "search/en" for English and  
using the default
"index".

Can anyone give me pointers on how to deal with this problem? Do I  
have to take a
spanner to org.apache.cocoon.generation.SearchGenerator in the Lucene  
block and
change something?

Steve


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: searching with Lucene in bilingual Cocoon site [SOLVED]

Posted by Stephen Winnall <st...@winnall.ch>.
Hi Christoph

Thank you. That's where I was making my mistake.

The <map:generators> element should NOT include an <index> element.

     <map:generators>
         <map:generator name="search-de"  
src="org.apache.cocoon.generation.SearchGenerator">
             <analyzer> org.apache.lucene.analysis.de.GermanAnalyzer  
</analyzer>
         </map:generator>

         <map:generator name="search-en"  
src="org.apache.cocoon.generation.SearchGenerator">
             <analyzer>  
org.apache.lucene.analysis.standard.StandardAnalyzer </analyzer>
         </map:generator>
     </map:generators>

As you point out, the <map:generate> element SHOULD include an index  
parameter
which points at the index files that have been created (in this case  
relative to work-directory):

     <map:generate type="search-de">
         <map:parameter name="index" value="search-de" />
     </map:generate>

     <map:generate type="search-en">
         <map:parameter name="index" value="search-en" />
     </map:generate>

It's easy when you know how... ;-)

Steve

On 28 Jun 2006, at 13:32, Christoph Hermann wrote:

> Stephen Winnall schrieb:
>
> Hello,
>
>> I tried your suggestion but it has no effect. It still complains that
>> the directory
>> "index" does not exist.
>>
>> I'll take a closer look at the source code, I think.
>
> I do:
> <map:generate type="search" label="searchcontent">
> <map:parameter name="index"
> value="{realpath:{ev:/config/site/base-path}/data/lucene/site}" />
> </map:generate>
>
> So maybe using realpath helps in your case.
>
> HTH
> Christoph
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: searching with Lucene in bilingual Cocoon site

Posted by Christoph Hermann <ch...@guschtel.de>.
Stephen Winnall schrieb:

Hello,

> I tried your suggestion but it has no effect. It still complains that
> the directory
> "index" does not exist.
> 
> I'll take a closer look at the source code, I think.

I do:
<map:generate type="search" label="searchcontent">
<map:parameter name="index"
value="{realpath:{ev:/config/site/base-path}/data/lucene/site}" />
</map:generate>

So maybe using realpath helps in your case.

HTH
Christoph

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: searching with Lucene in bilingual Cocoon site

Posted by Stephen Winnall <st...@winnall.ch>.
Hi Kaj

I tried your suggestion but it has no effect. It still complains that  
the directory
"index" does not exist.

I'll take a closer look at the source code, I think.

Steve

On 27 Jun 2006, at 16:09, Kaj Kandler wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Stephen,
> just guessing a bit more.
>
> I looked at the source code
> - --- (2.1.9)
>         String index_file_name = par.getParameter(INDEX_PARAM,
> INDEX_PARAM_DEFAULT);
>         if (request.getParameter(INDEX_PARAM) != null) {
>             index_file_name = request.getParameter(INDEX_PARAM);
>         }
> - ---
> INDEX_PARAM = "index"
>
> This code does suggest to me, that it is possible to overwrite the
> general configuration in the request.
>
> I'd recommend to rename search/de, search/en to search-de, search- 
> en to
> make them more encoding friendly. Then give ....&index=search-de a  
> try.
>
> Hope that helps
>
> Kaj
>
> Stephen Winnall wrote:
>> Hi Kaj
>>
>> Thanks.
>>
>> That's the answer to the next question! As you say, the index  
>> directory
>> is created
>> under the work-directory, which is odd, to say the least because -  
>> as I
>> understand
>> and observe it - everything under the work-directory gets wiped  
>> out on a
>> restart
>> of Jetty. But having the stuff under WEB-INF/work does make more  
>> sense than
>> under /tmp. I've changed to that, but the problem persists.
>>
>> My problem is simply that I can create 2 indices (one for English and
>> one for
>> German) under the work-directory using the index transformer
>> (org.apache.cocoon.transformation.LuceneIndexTransformer) but I can't
>> access
>> them using org.apache.cocoon.generation.SearchGenerator because it  
>> always
>> looks for something called "index"...
>>
>> Steve
>>
>> On 27 Jun 2006, at 15:23, Kaj Kandler wrote:
>>
>> Hi Stephen,
>> I'm totally guessing here as I have limited experience with cocoon  
>> and
>> lucene.
>>
>> I found I have more control over where the indices are, when I define
>> "work-directory" in my web.xml (just uncomment.) It seems to me  
>> you are
>> using the default and that is in tmp, where I'm sure you don't  
>> want the
>> indeces to be. If you uncomment, The indeces will be in
>> WEB-INF/work/searc-[de|en] (if you defien them so at generation time)
>> and you can see and control them better.
>>
>> Good luck
>>
>> K<o>
>>
>>
>> Stephen Winnall wrote:
>>>>> I'm implementing a bilingual website using Cocoon 2.1.8. I want  
>>>>> a search
>>>>> facility, so
>>>>> I'm trying to use the Lucene block to implement it. Since the two
>>>>> languages (English
>>>>> and German) have different stop lists, stemming rules etc., and  
>>>>> any
>>>>> given word may
>>>>> have a different meaning depending on the language, it seems to me
>>>>> appropriate
>>>>> to have two separate indices.
>>>>>
>>>>> The following extracts from my sitemap show how I have tried to  
>>>>> solve
>>>>> this:
>>>>>
>>>>> <map:components>
>>>>>
>>>>>     ....
>>>>>
>>>>>     <map:generators>
>>>>>
>>>>>         ....
>>>>>
>>>>>         <map:generator name="search-de"
>>>>> src="org.apache.cocoon.generation.SearchGenerator">
>>>>>             <index>search/de</index>
>>>>>             <analyzer>org.apache.lucene.analysis.de.GermanAnalyzer
>>>>> </analyzer>
>>>>>         </map:generator>
>>>>>
>>>>>         <map:generator name="search-en"
>>>>> src="org.apache.cocoon.generation.SearchGenerator">
>>>>>             <index>search/en</index>
>>>>>
>>>>> <analyzer>org.apache.lucene.analysis.standard.StandardAnalyzer</ 
>>>>> analyzer>
>>>>>
>>>>>         </map:generator>
>>>>>
>>>>>         ....
>>>>>
>>>>>     </map:generators>
>>>>>
>>>>>     ....
>>>>>
>>>>> </map:components>
>>>>>
>>>>> <map:pipelines>
>>>>>
>>>>>     ....
>>>>>
>>>>>     <map:pipeline>
>>>>>
>>>>>         ....
>>>>>
>>>>>         <map:match pattern="search">
>>>>>             <map:act type="locale">
>>>>>                 <map:select type="parameter">
>>>>>                     <map:parameter name="parameter-selector-test"
>>>>> value="{language}" />
>>>>>                     <map:when test="de">
>>>>>                         <map:generate type="search-de" />
>>>>>                     </map:when>
>>>>>                     <map:otherwise>
>>>>>                         <map:generate type="search-en" />
>>>>>                     </map:otherwise>
>>>>>                 </map:select>
>>>>>             </map:act>
>>>>>             <map:serialize type="xml" />
>>>>>         </map:match>
>>>>>
>>>>>         ....
>>>>>
>>>>>     </map:pipeline>
>>>>>
>>>>>     ....
>>>>>
>>>>> </map:pipelines>
>>>>>
>>>>>
>>>>> However, when I invoke the URI /search I get the following  
>>>>> error from
>>>>> Jetty:
>>>>>
>>>>>     java.io.IOException: /private/tmp/Jetty__8888__/cocoon- 
>>>>> files/index
>>>>> not a directory
>>>>>
>>>>> Apparently Cocoon is ignoring the <index> entry in the  
>>>>> <map:generator>
>>>>> element, where
>>>>> I specified "search/de" for German and "search/en" for English  
>>>>> and using
>>>>> the default
>>>>> "index".
>>>>>
>>>>> Can anyone give me pointers on how to deal with this problem?  
>>>>> Do I have
>>>>> to take a
>>>>> spanner to org.apache.cocoon.generation.SearchGenerator in the  
>>>>> Lucene
>>>>> block and
>>>>> change something?
>>>>>
>>>>> Steve
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------ 
>>>>> ---
>>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>>
>>
>> --
>> KajKandler@Conficio.com
>>  http://conficio.blogspot.com/
>>  ================================================
>>  |  We teach software one screencast at a time  |
>>  ================================================
>>  http://www.conficio.com/
>>  Tel: +1 (781) 632 5773 - Fax: +1 (781) 207 9159
>>  Conficio
>>  P.O.Box 761062,  Melrose,
>>  MA 02176
>>
>>>
> -  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
> - --
> KajKandler@Conficio.com
>  http://conficio.blogspot.com/
>  ================================================
>  |  We teach software one screencast at a time  |
>  ================================================
>  http://www.conficio.com/
>  Tel: +1 (781) 632 5773 - Fax: +1 (781) 207 9159
>  Conficio
>  P.O.Box 761062,  Melrose,
>  MA 02176
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (MingW32)
>
> iD8DBQFEoTwdRDUvrJRNjTARAuEqAJ99cw6baMaWs21VpAJaShydmEOd2QCeKy9D
> kE86BcJWCp/yyKfgydmB6WI=
> =WgWr
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: searching with Lucene in bilingual Cocoon site

Posted by Kaj Kandler <Ka...@Conficio.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stephen,
just guessing a bit more.

I looked at the source code
- --- (2.1.9)
        String index_file_name = par.getParameter(INDEX_PARAM,
INDEX_PARAM_DEFAULT);
        if (request.getParameter(INDEX_PARAM) != null) {
            index_file_name = request.getParameter(INDEX_PARAM);
        }
- ---
INDEX_PARAM = "index"

This code does suggest to me, that it is possible to overwrite the
general configuration in the request.

I'd recommend to rename search/de, search/en to search-de, search-en to
make them more encoding friendly. Then give ....&index=search-de a try.

Hope that helps

Kaj

Stephen Winnall wrote:
> Hi Kaj
> 
> Thanks.
> 
> That's the answer to the next question! As you say, the index directory
> is created
> under the work-directory, which is odd, to say the least because - as I
> understand
> and observe it - everything under the work-directory gets wiped out on a
> restart
> of Jetty. But having the stuff under WEB-INF/work does make more sense than
> under /tmp. I've changed to that, but the problem persists.
> 
> My problem is simply that I can create 2 indices (one for English and
> one for
> German) under the work-directory using the index transformer
> (org.apache.cocoon.transformation.LuceneIndexTransformer) but I can't
> access
> them using org.apache.cocoon.generation.SearchGenerator because it always
> looks for something called "index"...
> 
> Steve
> 
> On 27 Jun 2006, at 15:23, Kaj Kandler wrote:
> 
> Hi Stephen,
> I'm totally guessing here as I have limited experience with cocoon and
> lucene.
> 
> I found I have more control over where the indices are, when I define
> "work-directory" in my web.xml (just uncomment.) It seems to me you are
> using the default and that is in tmp, where I'm sure you don't want the
> indeces to be. If you uncomment, The indeces will be in
> WEB-INF/work/searc-[de|en] (if you defien them so at generation time)
> and you can see and control them better.
> 
> Good luck
> 
> K<o>
> 
> 
> Stephen Winnall wrote:
>>>> I'm implementing a bilingual website using Cocoon 2.1.8. I want a search
>>>> facility, so
>>>> I'm trying to use the Lucene block to implement it. Since the two
>>>> languages (English
>>>> and German) have different stop lists, stemming rules etc., and any
>>>> given word may
>>>> have a different meaning depending on the language, it seems to me
>>>> appropriate
>>>> to have two separate indices.
>>>>
>>>> The following extracts from my sitemap show how I have tried to solve
>>>> this:
>>>>
>>>> <map:components>
>>>>
>>>>     ....
>>>>
>>>>     <map:generators>
>>>>
>>>>         ....
>>>>
>>>>         <map:generator name="search-de"
>>>> src="org.apache.cocoon.generation.SearchGenerator">
>>>>             <index>search/de</index>
>>>>             <analyzer>org.apache.lucene.analysis.de.GermanAnalyzer
>>>> </analyzer>
>>>>         </map:generator>
>>>>
>>>>         <map:generator name="search-en"
>>>> src="org.apache.cocoon.generation.SearchGenerator">
>>>>             <index>search/en</index>
>>>>
>>>> <analyzer>org.apache.lucene.analysis.standard.StandardAnalyzer</analyzer>
>>>>
>>>>         </map:generator>
>>>>
>>>>         ....
>>>>
>>>>     </map:generators>
>>>>
>>>>     ....
>>>>
>>>> </map:components>
>>>>
>>>> <map:pipelines>
>>>>
>>>>     ....
>>>>
>>>>     <map:pipeline>
>>>>
>>>>         ....
>>>>
>>>>         <map:match pattern="search">
>>>>             <map:act type="locale">
>>>>                 <map:select type="parameter">
>>>>                     <map:parameter name="parameter-selector-test"
>>>> value="{language}" />
>>>>                     <map:when test="de">
>>>>                         <map:generate type="search-de" />
>>>>                     </map:when>
>>>>                     <map:otherwise>
>>>>                         <map:generate type="search-en" />
>>>>                     </map:otherwise>
>>>>                 </map:select>
>>>>             </map:act>
>>>>             <map:serialize type="xml" />
>>>>         </map:match>
>>>>
>>>>         ....
>>>>
>>>>     </map:pipeline>
>>>>
>>>>     ....
>>>>
>>>> </map:pipelines>
>>>>
>>>>
>>>> However, when I invoke the URI /search I get the following error from
>>>> Jetty:
>>>>
>>>>     java.io.IOException: /private/tmp/Jetty__8888__/cocoon-files/index
>>>> not a directory
>>>>
>>>> Apparently Cocoon is ignoring the <index> entry in the <map:generator>
>>>> element, where
>>>> I specified "search/de" for German and "search/en" for English and using
>>>> the default
>>>> "index".
>>>>
>>>> Can anyone give me pointers on how to deal with this problem? Do I have
>>>> to take a
>>>> spanner to org.apache.cocoon.generation.SearchGenerator in the Lucene
>>>> block and
>>>> change something?
>>>>
>>>> Steve
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>
> 
> --
> KajKandler@Conficio.com
>  http://conficio.blogspot.com/
>  ================================================
>  |  We teach software one screencast at a time  |
>  ================================================
>  http://www.conficio.com/
>  Tel: +1 (781) 632 5773 - Fax: +1 (781) 207 9159
>  Conficio
>  P.O.Box 761062,  Melrose,
>  MA 02176
> 
>>
- ---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
>>

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


- --
KajKandler@Conficio.com
 http://conficio.blogspot.com/
 ================================================
 |  We teach software one screencast at a time  |
 ================================================
 http://www.conficio.com/
 Tel: +1 (781) 632 5773 - Fax: +1 (781) 207 9159
 Conficio
 P.O.Box 761062,  Melrose,
 MA 02176

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)

iD8DBQFEoTwdRDUvrJRNjTARAuEqAJ99cw6baMaWs21VpAJaShydmEOd2QCeKy9D
kE86BcJWCp/yyKfgydmB6WI=
=WgWr
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: searching with Lucene in bilingual Cocoon site

Posted by Stephen Winnall <st...@winnall.ch>.
Hi Kaj

Thanks.

That's the answer to the next question! As you say, the index  
directory is created
under the work-directory, which is odd, to say the least because - as  
I understand
and observe it - everything under the work-directory gets wiped out  
on a restart
of Jetty. But having the stuff under WEB-INF/work does make more  
sense than
under /tmp. I've changed to that, but the problem persists.

My problem is simply that I can create 2 indices (one for English and  
one for
German) under the work-directory using the index transformer
(org.apache.cocoon.transformation.LuceneIndexTransformer) but I can't  
access
them using org.apache.cocoon.generation.SearchGenerator because it  
always
looks for something called "index"...

Steve

On 27 Jun 2006, at 15:23, Kaj Kandler wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Stephen,
> I'm totally guessing here as I have limited experience with cocoon and
> lucene.
>
> I found I have more control over where the indices are, when I define
> "work-directory" in my web.xml (just uncomment.) It seems to me you  
> are
> using the default and that is in tmp, where I'm sure you don't want  
> the
> indeces to be. If you uncomment, The indeces will be in
> WEB-INF/work/searc-[de|en] (if you defien them so at generation time)
> and you can see and control them better.
>
> Good luck
>
> K<o>
>
>
> Stephen Winnall wrote:
>> I'm implementing a bilingual website using Cocoon 2.1.8. I want a  
>> search
>> facility, so
>> I'm trying to use the Lucene block to implement it. Since the two
>> languages (English
>> and German) have different stop lists, stemming rules etc., and any
>> given word may
>> have a different meaning depending on the language, it seems to me
>> appropriate
>> to have two separate indices.
>>
>> The following extracts from my sitemap show how I have tried to  
>> solve this:
>>
>> <map:components>
>>
>>     ....
>>
>>     <map:generators>
>>
>>         ....
>>
>>         <map:generator name="search-de"
>> src="org.apache.cocoon.generation.SearchGenerator">
>>             <index>search/de</index>
>>             <analyzer>org.apache.lucene.analysis.de.GermanAnalyzer
>> </analyzer>
>>         </map:generator>
>>
>>         <map:generator name="search-en"
>> src="org.apache.cocoon.generation.SearchGenerator">
>>             <index>search/en</index>
>>
>> <analyzer>org.apache.lucene.analysis.standard.StandardAnalyzer</ 
>> analyzer>
>>         </map:generator>
>>
>>         ....
>>
>>     </map:generators>
>>
>>     ....
>>
>> </map:components>
>>
>> <map:pipelines>
>>
>>     ....
>>
>>     <map:pipeline>
>>
>>         ....
>>
>>         <map:match pattern="search">
>>             <map:act type="locale">
>>                 <map:select type="parameter">
>>                     <map:parameter name="parameter-selector-test"
>> value="{language}" />
>>                     <map:when test="de">
>>                         <map:generate type="search-de" />
>>                     </map:when>
>>                     <map:otherwise>
>>                         <map:generate type="search-en" />
>>                     </map:otherwise>
>>                 </map:select>
>>             </map:act>
>>             <map:serialize type="xml" />
>>         </map:match>
>>
>>         ....
>>
>>     </map:pipeline>
>>
>>     ....
>>
>> </map:pipelines>
>>
>>
>> However, when I invoke the URI /search I get the following error from
>> Jetty:
>>
>>     java.io.IOException: /private/tmp/Jetty__8888__/cocoon-files/ 
>> index
>> not a directory
>>
>> Apparently Cocoon is ignoring the <index> entry in the  
>> <map:generator>
>> element, where
>> I specified "search/de" for German and "search/en" for English and  
>> using
>> the default
>> "index".
>>
>> Can anyone give me pointers on how to deal with this problem? Do I  
>> have
>> to take a
>> spanner to org.apache.cocoon.generation.SearchGenerator in the Lucene
>> block and
>> change something?
>>
>> Steve
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
> - --
> KajKandler@Conficio.com
>  http://conficio.blogspot.com/
>  ================================================
>  |  We teach software one screencast at a time  |
>  ================================================
>  http://www.conficio.com/
>  Tel: +1 (781) 632 5773 - Fax: +1 (781) 207 9159
>  Conficio
>  P.O.Box 761062,  Melrose,
>  MA 02176
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (MingW32)
>
> iD8DBQFEoTE1RDUvrJRNjTARAvvZAKCO7sVdI95dT+tscyCV3pDkADtWtQCdH0ev
> 5FeEKRstCEiVtqOveEHSlDI=
> =FfVU
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: searching with Lucene in bilingual Cocoon site

Posted by Kaj Kandler <Ka...@Conficio.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Stephen,
I'm totally guessing here as I have limited experience with cocoon and
lucene.

I found I have more control over where the indices are, when I define
"work-directory" in my web.xml (just uncomment.) It seems to me you are
using the default and that is in tmp, where I'm sure you don't want the
indeces to be. If you uncomment, The indeces will be in
WEB-INF/work/searc-[de|en] (if you defien them so at generation time)
and you can see and control them better.

Good luck

K<o>


Stephen Winnall wrote:
> I'm implementing a bilingual website using Cocoon 2.1.8. I want a search
> facility, so
> I'm trying to use the Lucene block to implement it. Since the two
> languages (English
> and German) have different stop lists, stemming rules etc., and any
> given word may
> have a different meaning depending on the language, it seems to me
> appropriate
> to have two separate indices.
> 
> The following extracts from my sitemap show how I have tried to solve this:
> 
> <map:components>
> 
>     ....
> 
>     <map:generators>
> 
>         ....
> 
>         <map:generator name="search-de"
> src="org.apache.cocoon.generation.SearchGenerator">
>             <index>search/de</index>
>             <analyzer>org.apache.lucene.analysis.de.GermanAnalyzer
> </analyzer>
>         </map:generator>
> 
>         <map:generator name="search-en"
> src="org.apache.cocoon.generation.SearchGenerator">
>             <index>search/en</index>
>            
> <analyzer>org.apache.lucene.analysis.standard.StandardAnalyzer</analyzer>
>         </map:generator>
> 
>         ....
> 
>     </map:generators>
> 
>     ....
> 
> </map:components>
> 
> <map:pipelines>
> 
>     ....
> 
>     <map:pipeline>
> 
>         ....
> 
>         <map:match pattern="search">
>             <map:act type="locale">
>                 <map:select type="parameter">
>                     <map:parameter name="parameter-selector-test"
> value="{language}" />
>                     <map:when test="de">
>                         <map:generate type="search-de" />
>                     </map:when>
>                     <map:otherwise>
>                         <map:generate type="search-en" />
>                     </map:otherwise>
>                 </map:select>
>             </map:act>
>             <map:serialize type="xml" />
>         </map:match>
> 
>         ....
> 
>     </map:pipeline>
> 
>     ....
> 
> </map:pipelines>
> 
> 
> However, when I invoke the URI /search I get the following error from
> Jetty:
> 
>     java.io.IOException: /private/tmp/Jetty__8888__/cocoon-files/index
> not a directory
> 
> Apparently Cocoon is ignoring the <index> entry in the <map:generator>
> element, where
> I specified "search/de" for German and "search/en" for English and using
> the default
> "index".
> 
> Can anyone give me pointers on how to deal with this problem? Do I have
> to take a
> spanner to org.apache.cocoon.generation.SearchGenerator in the Lucene
> block and
> change something?
> 
> Steve
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

- --
KajKandler@Conficio.com
 http://conficio.blogspot.com/
 ================================================
 |  We teach software one screencast at a time  |
 ================================================
 http://www.conficio.com/
 Tel: +1 (781) 632 5773 - Fax: +1 (781) 207 9159
 Conficio
 P.O.Box 761062,  Melrose,
 MA 02176

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)

iD8DBQFEoTE1RDUvrJRNjTARAvvZAKCO7sVdI95dT+tscyCV3pDkADtWtQCdH0ev
5FeEKRstCEiVtqOveEHSlDI=
=FfVU
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org