lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Walker, Keith 1" <>
Subject Running Lucene as a stateless session bean
Date Tue, 20 Feb 2007 19:22:33 GMT
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.

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:

				datastoreURLStr);  [GATE call]
indexedCorpus.getIndexManager().createIndex();  [GATE call that uses
Lucene under the hood]
IndexSearcher search = new IndexSearcher(this.indexedCorpus
luceneQuery = QueryParser.parse(theQuery,"body", new SimpleAnalyzer());
Hits hits =;
Explanation ex = search.explain(luceneQuery,;
Factory.deleteResource(this.indexedCorpus); [GATE call]


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message