lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leslie Hughes <Leslie.Hug...@watercorporation.com.au>
Subject RE: Index Path in WAR
Date Mon, 05 May 2003 01:28:58 GMT

Hi,

I've written a simple WARDirectory which delegates to either a RAMDir or
FSDir. The WARDir is initialised by a listener (servlet 2.3/4? spec) and
either copies the index to the servlet temp directory or to RAM depending
upon a setting in the web.xml file.

I dont have the source with me but if you want, I'll bring it into work
tomorrow.

I did think about going the jardir route but had performance concerns about
lucene accessing a single jarfile.

Bye

Les



> -----Original Message-----
> From:	Kevin Moran [SMTP:gridplan@yahoo.com]
> Sent:	Monday, May 05, 2003 8:38 AM
> To:	Lucene Users List
> Subject:	Re: Index Path in WAR
> 
> Hi Jason,
>     This may not be the best solution and may differ
> from your situation if your index is read/write (mine
> isn't).  But hey, it works for me.  How I got around
> the problem was first to Jar up the index.  I Jarred
> it up uncompressed for speed.  I then subclassed
> Directory.  I called it JarDirectory.  I made
> JarDirectory's constructor use
> ClassLoader.getResource() to find the Jar and then
> create a java.util.jar.JarFile from it.  The methods I
> overrode in Directory (e.g., list(), fileExists(),
> etc.) use the JarFile as appropriate.  After I
> debugged that class all I had to do was create an
> instance of JarDirectory and pass it to
> IndexSearcher's constructor.  My searches then went
> against the Jar file.  As long as the Jar is in the
> classpath -- which you can bundle with your web app
> and set a classpath to in your manifest file -- it
> works.  That allows you to bundle the index with the
> web app and avoid hard-coding a path to it.
> 
> HTH,
> -kevin
> 
> P.S. Unfortunately, I can't provide the source to
> JarDirectory as it is not mine to give.  But it didn't
> take long to write and was less than 400 lines long. 
> Maybe someone else on the mailing list can point you
> to a better concrete example.
> 
> --- Jason.Cox@trw.com wrote:
> > List,
> > 
> > I'm having problems using an absolute path to the
> > index directory when my web application is deployed
> > in a WAR file.  The absolute path changes depending
> > on the server.  Is there a way to either dynamically
> > determine an absolute path to the index directory or
> > to use relative pathing?
> > 
> > Thanks in advance,
> > 
> > Jason
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > lucene-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > lucene-user-help@jakarta.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message