lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doron Cohen <>
Subject Re: Running Lucene as a stateless session bean
Date Tue, 20 Feb 2007 20:40:17 GMT
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.


"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 =;
> Explanation ex = search.explain(luceneQuery,;
> deleteDirectory(this.indexSubDir);
> Factory.deleteResource(this.indexedCorpus); [GATE call]
> Thanks,
> Keith

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

View raw message