RE: closing an IndexSearcher
I have run my code with eclipse debugger and the IndexReader is closed (I mean it steps into the reader.close() statement) but the search over this IndexReader still works. Should a query work on a closed indexReader or should it throw an IOException ? -Message d'origine- De : Erik Hatcher [mailto:[EMAIL PROTECTED] Envoyé : mercredi 19 janvier 2005 18:31 À : Lucene Users List Objet : Re: closing an IndexSearcher On Jan 19, 2005, at 12:14 PM, Cocula Remi wrote: Hi , I remarked that after closing an IndexSearcher, queries on this Seacher will still run. My question is : why not always closing an IndexSearcher ? IndexSearcher.close: public void close() throws IOException { if(closeReader) reader.close(); } However, you open it with a String: - searcher = new IndexSearcher(c:\\tmp\\index); Which should close the underlying IndexReader. Maybe this was a bug that has since been fixed in CVS (which is the code I'm referencing)? Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: closing an IndexSearcher
Complementary to my prvious mail I noticed strange behaviour of IndexSearcher.close(). Here is a code that does not work : the new IndexWriter() statement throws java.io.IOException: Cannot delete _3.cfs as if the Index searcher's underlying IndexReader where not closed. IndexSearcher searcher = new IndexSearcher(c:\\tmp\\index); searcher = new IndexSearcher(c:\\tmp\\index); searcher.close(); writer = new IndexWriter(c:\\tmp\\index,ana,true); doc = new Document(); doc.add(Field.Text(text,toto li toto)); writer.addDocument(doc); writer.close(); And now here is a code that works : the only differance with the previous one is the QueryParser call before new IndexWriter. The QueryParser .parse statement seems to close the IndexReader but I really can't figure how. IndexSearcher searcher = new IndexSearcher(c:\\tmp\\index); searcher = new IndexSearcher(c:\\tmp\\index); searcher.close(); Query query = QueryParser.parse(toto,text,ana); writer = new IndexWriter(c:\\tmp\\index,ana,true); doc = new Document(); doc.add(Field.Text(text,toto li toto)); writer.addDocument(doc); writer.close(); Note : I use Lucene 1.4 Final Does it seem to be a bug ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: closing an IndexSearcher
IndexSearcher searcher = new IndexSearcher(c:\\tmp\\index); searcher = new IndexSearcher(c:\\tmp\\index); searcher.close(); Wouldn't the following mean you have two IndexSearcher instances, where you would only close the last one? Try just the first and the third line, thus: IndexSearcher searcher = new IndexSearcher(c:\\tmp\\index); searcher.close(); Greetz, Nick Disclaimer: ' Aan de inhoud van dit bericht kunnen alleen rechten ten opzichte van Interpay Nederland B.V. of aan haar gelieerde ondernemingen worden ontleend, indien zij door rechtsgeldig ondertekende stukken worden ondersteund. De informatie in dit e-mailbericht is van vertrouwelijke aard en alleen bedoeld voor gebruik door de geadresseerde. Als u een bericht onbedoeld heeft ontvangen, wordt u verzocht de verzender hiervan in kennis te stellen en het bericht te vernietigen zonder van de inhoud kennis te nemen, deze te vermenigvuldigen of andersoortig te gebruiken.' An English version of this disclaimer is available on http://www.interpay.nl/xhtml/ContentEng.aspx?linkid=en-04-00-00-00-00-00-001 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: closing an IndexSearcher
Hi Cocula, And now here is a code that works : the only differance with the previous one is the QueryParser call before new IndexWriter. The QueryParser .parse statement seems to close the IndexReader but I really can't figure how. I rather suspect your OS/filesystem to delay the effect of the close. QueryParser does not even know about your searcher. What OS are you using? Morus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: closing an IndexSearcher
You are wright ! I didn't notice that. -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoyé : jeudi 20 janvier 2005 12:50 À : lucene-user@jakarta.apache.org Objet : RE: closing an IndexSearcher IndexSearcher searcher = new IndexSearcher(c:\\tmp\\index); searcher = new IndexSearcher(c:\\tmp\\index); searcher.close(); Wouldn't the following mean you have two IndexSearcher instances, where you would only close the last one? Try just the first and the third line, thus: IndexSearcher searcher = new IndexSearcher(c:\\tmp\\index); searcher.close(); Greetz, Nick Disclaimer: ' Aan de inhoud van dit bericht kunnen alleen rechten ten opzichte van Interpay Nederland B.V. of aan haar gelieerde ondernemingen worden ontleend, indien zij door rechtsgeldig ondertekende stukken worden ondersteund. De informatie in dit e-mailbericht is van vertrouwelijke aard en alleen bedoeld voor gebruik door de geadresseerde. Als u een bericht onbedoeld heeft ontvangen, wordt u verzocht de verzender hiervan in kennis te stellen en het bericht te vernietigen zonder van de inhoud kennis te nemen, deze te vermenigvuldigen of andersoortig te gebruiken.' An English version of this disclaimer is available on http://www.interpay.nl/xhtml/ContentEng.aspx?linkid=en-04-00-00-00-00-00-001 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: closing an IndexSearcher
As said [EMAIL PROTECTED] I was openning multiple instances of IndexSearcher. Now the IndexReader seems to be closed but I am surprised that the searching over this closed index Reader still work, that was the original subject of this thread. -Message d'origine- De : Morus Walter [mailto:[EMAIL PROTECTED] Envoyé : jeudi 20 janvier 2005 12:52 À : Lucene Users List Objet : RE: closing an IndexSearcher Hi Cocula, And now here is a code that works : the only differance with the previous one is the QueryParser call before new IndexWriter. The QueryParser .parse statement seems to close the IndexReader but I really can't figure how. I rather suspect your OS/filesystem to delay the effect of the close. QueryParser does not even know about your searcher. What OS are you using? Morus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: closing an IndexSearcher
On Jan 19, 2005, at 12:14 PM, Cocula Remi wrote: Hi , I remarked that after closing an IndexSearcher, queries on this Seacher will still run. My question is : why not always closing an IndexSearcher ? IndexSearcher.close: public void close() throws IOException { if(closeReader) reader.close(); } However, you open it with a String: - searcher = new IndexSearcher(c:\\tmp\\index); Which should close the underlying IndexReader. Maybe this was a bug that has since been fixed in CVS (which is the code I'm referencing)? Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Closing the IndexSearcher object
I think this is a FAQ. Keep that single IndexSearcher until you change the index and want that IS to see those changes. Otis --- Karl Koch [EMAIL PROTECTED] wrote: Hi all, I have a search method who is used by many programs with different queries. I therefore do not want to close the IndexSearch object to allow other programs to reuse it. Does this have any side effects (e.g. does the IndexSearcher object contain state information)? Would it be better to instanciate always a new IndexSearch object and close it after usage? Cheers, Karl -- +++ GMX - die erste Adresse für Mail, Message, More +++ Bis 31.1.: TopMail + Digicam für nur 29 EUR http://www.gmx.net/topmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]