You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by YAN HE <yh...@cs.odu.edu> on 2005/03/08 16:53:40 UTC

Could you please tell me how to set the directory of Lucene index?

空白

Hello, all,

When I created an Lucene index by CoCoon, I found a directory named "index" existed below the temporary working directory of the servlet engine (Jetty). After I stopped the cocoon server, this directory was deleted. So I have to recreate the index every time the cocoon server restarts. Can we store the index file created in other directory and keep it when the cocoon server stops? Which configuration file should we change?Or we have to change the cocoon source code?

Thanks a lot.


Re: Could you please tell me how to set the directory of Lucene index?

Posted by Jeremy Quinn <je...@apache.org>.
Hi Daniel,

If no index directory parameter is supplied to Lucene, it uses the 
Servlet work directory.
Jetty naturally deletes the contents of this on restart, hence your 
problem.

The way you set the index directory depends on what components you use 
with Lucene.

The LuceneIndexTransformer (which creates or updates indexes) can be 
told where to write the index by using the 'directory' attribute in the 
XML that you send it. eg :

<lucene:index
      analyzer="org.apache.lucene.analysis.standard.StandardAnalyzer"
      directory="/path/to/index/"
      create="true"
      merge-factor="20">
   <lucene:document url="url-of-doc">
	. . .
   </lucene:document>
   <lucene:document url="url-of-doc">
	. . .
   </lucene:document>
   . . .
</lucene:index>

The SearchGenerator can be given an 'index' parameter, to tell it where 
the index you want to search is, eg :

<map:generate type="search">
      <map:parameter name="index" value="/path/to/index/"/>
      . . .
</map:generate>

You would typically supply both of these parameters via an input-module 
from a global configuration.

The API documentation could be better.

If you use XSP to create or search indexes (not recommended) you can 
modify the code to pass in your directory location.

HTH

regards Jeremy


On 8 Mar 2005, at 18:31, Daniel McOrmond wrote:

> Have you tried posting your question to the Lucene users list?
>
> lucene-user@jakarta.apache.org
>
> -Daniel
>
>
> On Tue, 8 Mar 2005 10:53:40 -0500, YAN HE <yh...@cs.odu.edu> wrote:
>> When I created an Lucene index by CoCoon, I found a directory named 
>> "index"
>> existed below the temporary working directory of the servlet engine 
>> (Jetty).
>> After I stopped the cocoon server, this directory was deleted. So I 
>> have to
>> recreate the index every time the cocoon server restarts. Can we 
>> store the
>> index file created in other directory and keep it when the cocoon 
>> server
>> stops? Which configuration file should we change?Or we have to change 
>> the
>> cocoon source code?
>
>
--------------------------------------------------------

                   If email from this address is not signed
                                 IT IS NOT FROM ME

                         Always check the label, folks !!!!!
--------------------------------------------------------


Re: Could you please tell me how to set the directory of Lucene index?

Posted by Daniel McOrmond <dm...@gmail.com>.
Have you tried posting your question to the Lucene users list?

lucene-user@jakarta.apache.org

-Daniel


On Tue, 8 Mar 2005 10:53:40 -0500, YAN HE <yh...@cs.odu.edu> wrote:
> When I created an Lucene index by CoCoon, I found a directory named "index"
> existed below the temporary working directory of the servlet engine (Jetty).
> After I stopped the cocoon server, this directory was deleted. So I have to
> recreate the index every time the cocoon server restarts. Can we store the
> index file created in other directory and keep it when the cocoon server
> stops? Which configuration file should we change?Or we have to change the
> cocoon source code?