----- Original Message ----- From: "Erik Hatcher" <[EMAIL PROTECTED]> To: <java-user@lucene.apache.org> Sent: Wednesday, October 05, 2005 8:20 PM Subject: Re: IndexSearcher in servlet containers
> > On Oct 5, 2005, at 2:09 PM, Cyril Barlow wrote: > >> I'm really confused on the dilemma here. > >> > >> You can create a startup hook using one of the Servlet specification > >> listeners, create an IndexSearcher there, stuff it into application > >> scope (context.setAttribute()). > >> > >> There is no digging into Jetty's guts needed, just plain and simple > >> servlet API will suffice. > >> > >> Of course you'll also want a facility to re-instantiate the > >> IndexSearcher if the index is changing, but that is just building > >> upon the pieces I just described. > >> > > > > OK, I add a IndexSearcher object using the context.setAttribute(IS) > > but how > > do I refer back to it from the servlet code? > > Uh... IndexSearcher searcher = (IndexSearcher) context.getAttribute > ("<some key>") > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > Using one IndexSearcher across the whole application doesn't seem to work. I'm getting : java.io.IOException: The handle is invalid at java.io.RandomAccessFile.seek(Native Method) at org.apache.lucene.store.FSInputStream.readInternal(FSDirectory.java:415) at org.apache.lucene.store.InputStream.readBytes(InputStream.java:61) at org.apache.lucene.index.CompoundFileReader$CSInputStream.readInternal(Compou ndFileReader.java:220) at org.apache.lucene.store.InputStream.refill(InputStream.java:158) at org.apache.lucene.store.InputStream.readByte(InputStream.java:43) at org.apache.lucene.store.InputStream.readVInt(InputStream.java:83) at org.apache.lucene.index.SegmentTermEnum.readTerm(SegmentTermEnum.java:142) at org.apache.lucene.index.SegmentTermEnum.next(SegmentTermEnum.java:115) at org.apache.lucene.index.TermInfosReader.scanEnum(TermInfosReader.java:143) at org.apache.lucene.index.TermInfosReader.get(TermInfosReader.java:132) at org.apache.lucene.index.SegmentReader.docFreq(SegmentReader.java:253) at org.apache.lucene.index.MultiReader.docFreq(MultiReader.java:192) at org.apache.lucene.search.IndexSearcher.docFreq(IndexSearcher.java:69) at org.apache.lucene.search.Similarity.idf(Similarity.java:255) at org.apache.lucene.search.TermQuery$TermWeight.sumOfSquaredWeights(TermQuery. java:47) at org.apache.lucene.search.BooleanQuery$BooleanWeight.sumOfSquaredWeights(Bool eanQuery.java:110) at org.apache.lucene.search.Query.weight(Query.java:86) at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:117) at org.apache.lucene.search.Hits.getMoreDocs(Hits.java:64) at org.apache.lucene.search.Hits.(Hits.java:51) at org.apache.lucene.search.Searcher.search(Searcher.java:41) at .......... This is after a few searches. Its ok before that. Any ideas? ___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]