lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Willnauer <simon.willna...@gmail.com>
Subject Re: Is creating an analyzer expensive?
Date Thu, 12 Jul 2012 22:22:13 GMT
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 <dseltzer@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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message