You can safely reuse a single analyzer across threads. The Analyzer class maintains ThreadLocal storage for TokenStreams internally so you can just create the analyzer once and use it throughout your application.
simon On Thu, Jul 12, 2012 at 10:13 PM, Dave Seltzer <dselt...@tveyes.com> wrote: > I have one more question to pose to the group today: > > I have several thousand searches being performed against MemoryIndexes on > a regular basis. > > I'd like the ability for each search to choose it's own Analyzer, such > that some queries could use a regex pattern, other queries could use the > Standard Analyzer. > > Does anyone know how expensive it is to create an Analyzer? Am I better > off creating analyzers as needed, or should I store them once and re-use > them? > > Thanks very much! > > -Dave > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org