lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Les Hughes <>
Subject RE: Indexes in WAR files
Date Fri, 15 Feb 2002 11:02:52 GMT

Hi Doug,

I haven't verified it but another one of our techies tells me that WLS
returns the name of the warfile that the webapp is sourced from without any
path info. I do need to check this for WLS 6.1 though ;-)

For my app, the index is only a few tens of megs so RAM isn't a problem.
Once I've sorted that version of WARDirectory out I'll probably annd
something that is either config's from the deployment descriptor
(use-ramdirectory = true kindof thing) or just unwar's the index into a temp
dir as you say. I'm guessing but since most Unix boxes use swap for /tmp
then this'll be nearly as fast as a RAMDirextory?

Either way, at the moment I'm grabbing a list of resources stored under (for
example /WEB-INF/index) doing a getResourceAsStream and then creating each
"file" in a RAMDirectory - in a similar way to your suggestion.

Hope to release something early next week.



> -----Original Message-----
> From: Doug Cutting []
> Sent: 14 February 2002 18:00
> To: 'Lucene Developers List'
> Subject: RE: Indexes in WAR files
> > From: Les Hughes []
> > 
> > Reading the servlet spec again it says that calls such as
> > servletcontext.getRealPath() will *possibly* return null if 
> > the content is
> > being served from a war as opposed the physical path on disk 
> > - I'm informed
> > that weblogic actually returns the name of the warfile and 
> > not the exploded
> > location. But you're right, Tomcat works differently.
> What kind of URL does weblogic return for
> servletContext.getResource("//index/segments")?
> Is it a file: URL?
> Keeping the index in files and using FSDirectory will be much more
> efficient.  If all the major servlet containers support this 
> it would be a
> shame not to take advantage of it.  You might look at the result of
> getResource and use an FSDirectory if a file: url is returned, and do
> something else when it's not.
> > So in order to isolate from different interpretations of the 
> > spec, I'm going
> > to knock up a WARDirectory that probably will wrap a 
> > RAMDirectory (going
> > back to the servlet container to getResourceAsStream seems 
> > awfully expensive
> > to me) as a first go.
> > I'll post my efforts in a couple of days.
> One technique you might consider is, when the index is not 
> available as a
> file, use getResourceAsStream to copy it to a temporary directory in
> System.getProperty(""), then use FSDirectory.  
> Storing the
> whole index in a RAMDirectory will make searches really fast, 
> but could also
> chew up a lot of memory.  If the index isn't that big anyway, 
> maybe this
> isn't an issue.
> Doug
> --
> To unsubscribe, e-mail:   
For additional commands, e-mail: <>

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

View raw message