lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "" <>
Subject RE: RE: Indexes in WAR files
Date Thu, 14 Feb 2002 21:54:24 GMT
I don't think you should do all that in the configuration jsp page... Somewhere..fine..   I'm
pretty opposed to using getRealPath() on whole.  Its evil.  It would seem rather there should
be an index reader that can take a war file directory as input for exactly this case...  It
can do the stream and all under the covers...


Original Message:
From: Doug Cutting
Date: Thu, 14 Feb 2002 10:00:24 -0800
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
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.


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

mail2web - Check your email from the web at .

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

View raw message