QueryParser not thread-safe

2005-08-23 Thread jhandl
Hi! I've been having problems with lucene's QueryParser, apparently it is not thread-safe. That means I can't parse queries in threads where the queryparser object is created once and reused for each query. If I do, the resulting queries may have all kinds of weird problems, for example missin

Re: QueryParser not thread-safe

2005-08-23 Thread Miles Barr
On Tue, 2005-08-23 at 13:47 -0300, [EMAIL PROTECTED] wrote: > Hi! I've been having problems with lucene's QueryParser, apparently it is not > thread-safe. > > That means I can't parse queries in threads where the queryparser object is > created once and reused for each query. If I do, the resul

Re: QueryParser not thread-safe

2005-08-23 Thread Luke Francl
On Tue, 2005-08-23 at 12:01, Miles Barr wrote: > Using a non-threadsafe object in a threaded environment is fairly > standard in Java, just wrap it in a synchronized block. > > If you don't want all threads waiting on one query parser, create a pool > of them. Based on doing the simplest possib

Re: QueryParser not thread-safe

2005-08-23 Thread Paul Elschot
On Tuesday 23 August 2005 19:01, Miles Barr wrote: > On Tue, 2005-08-23 at 13:47 -0300, [EMAIL PROTECTED] wrote: > > Hi! I've been having problems with lucene's QueryParser, apparently it is not thread-safe. > > > > That means I can't parse queries in threads where the queryparser object is cre

Re: QueryParser not thread-safe

2005-08-23 Thread jian chen
Right. My philosophy is that, make it work, then, make it better. Don't waste time on something that you are not sure if it would cause performance problem. Jian On 8/23/05, Paul Elschot <[EMAIL PROTECTED]> wrote: > On Tuesday 23 August 2005 19:01, Miles Barr wrote: > > On Tue, 2005-08-23 at 13

RE: QueryParser not thread-safe

2005-08-24 Thread Vanlerberghe, Luc
EMAIL PROTECTED] Sent: dinsdag 23 augustus 2005 21:38 To: java-user@lucene.apache.org Subject: Re: QueryParser not thread-safe Right. My philosophy is that, make it work, then, make it better. Don't waste time on something that you are not sure if it would cause performance problem. Ji

Re: QueryParser not thread-safe

2005-08-24 Thread Chris Lamprecht
alls > threadLocalQueryParser.get(). > > See the javadoc for java.lang.ThreadLocal > > Luc > > > -Original Message- > From: jian chen [mailto:[EMAIL PROTECTED] > Sent: dinsdag 23 augustus 2005 21:38 > To: java-user@lucene.apache.org > Subject: Re: Query

Re: QueryParser not thread-safe

2005-08-24 Thread jhandl
0 > Para: java-user@lucene.apache.org > Asunto: Re: QueryParser not thread-safe > > > I would just create a new QueryParser for each query. Allocating > short-lived objects is just about free in java, and the time spent > performing the actual search will by far dominate any time

Re: QueryParser not thread-safe

2005-08-24 Thread Miles Barr
On Wed, 2005-08-24 at 12:10 -0300, [EMAIL PROTECTED] wrote: > Now, while I agree that simple is better, I think QueryParser should > be made thread-safe through the use of a wrapper class (along the > line of what Luc suggested) or by using something other than javacc, > so this is no longer an