Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 31437 invoked from network); 20 Feb 2007 20:43:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Feb 2007 20:43:28 -0000 Received: (qmail 10104 invoked by uid 500); 20 Feb 2007 20:43:29 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 10068 invoked by uid 500); 20 Feb 2007 20:43:29 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 10051 invoked by uid 99); 20 Feb 2007 20:43:29 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Feb 2007 12:43:29 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of DORONC@il.ibm.com designates 195.212.29.155 as permitted sender) Received: from [195.212.29.155] (HELO mtagate6.de.ibm.com) (195.212.29.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Feb 2007 12:43:16 -0800 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate6.de.ibm.com (8.13.8/8.13.8) with ESMTP id l1KKgtva147540 for ; Tue, 20 Feb 2007 20:42:55 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.2) with ESMTP id l1KKgsLU1994898 for ; Tue, 20 Feb 2007 21:42:55 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l1KKgssM009153 for ; Tue, 20 Feb 2007 21:42:54 +0100 Received: from d12mc102.megacenter.de.ibm.com (d12mc102.megacenter.de.ibm.com [9.149.167.114]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l1KKgons009128 for ; Tue, 20 Feb 2007 21:42:50 +0100 In-Reply-To: <1AEC2AECA2A5B04BA1A56FADE29F0302024FCB15@emss10m05.us.lmco.com> Subject: Re: Running Lucene as a stateless session bean To: java-user@lucene.apache.org X-Mailer: Lotus Notes Release 7.0 HF277 June 21, 2006 Message-ID: From: Doron Cohen Date: Tue, 20 Feb 2007 12:40:17 -0800 X-MIMETrack: Serialize by Router on D12MC102/12/M/IBM(Release 7.0.2HF71 | November 3, 2006) at 20/02/2007 22:42:50 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Virus-Checked: Checked by ClamAV on apache.org Is that perhaps Lucene 1.4.3? (Current release is 2.1.0, I am not aware of 1.3, such old version is not even in the releases archives). The static parse() was deprecated at 1.9 and removed at 2.0, so it must be Lucene 1.9 or older. Anyhow, at least from Lucene point of view (I am not familiar with GATE), by instantiating (each time) a new QueryParser object and using it, there should be no thread safety problems. Regards, Doron "Walker, Keith 1" wrote on 20/02/2007 11:22:33: > I'm using an EJB to process documents using Lucene 1.3. Things are > working fine now, but I wanted to double check that this will work with > multiple instances of the EJB. I know this is not conforming to the EJB > spec concerning file I/O, but ignoring that for now, my question is > about thread safety. From the FAQ I see that IndexWriter and > IndexSearcher are thread safe, but QueryParser is not, so I'll have to > change that to a singleton. I think "singleton" would not be a good idea, thread safety wise. > > My use of Lucene is not the typical scenario: A document is converted > from it's original format (ex. PDF) using the GATE framework, then the > index created, a query parsed, the query run, and the index deleted. So > each call to the EJB is acting only on objects/index created during that > call. Here are the core steps: > > Factory.createDataStore("gate.persist.SerialDataStore", > datastoreURLStr); [GATE call] > indexedCorpus.getIndexManager().createIndex(); [GATE call that uses > Lucene under the hood] > IndexSearcher search = new IndexSearcher(this.indexedCorpus > > .getIndexDefinition().getIndexLocation()); > luceneQuery = QueryParser.parse(theQuery,"body", new SimpleAnalyzer()); > Hits hits = search.search(luceneQuery); > Explanation ex = search.explain(luceneQuery, hits.id(0)); > deleteDirectory(this.indexSubDir); > Factory.deleteResource(this.indexedCorpus); [GATE call] > > > Thanks, > Keith --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org