You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Jiye Yu <yu...@AI.SRI.COM> on 2007/06/22 23:26:38 UTC

Analyzer sharing

Hi,

I guess an Analyzer (built in ones such as StandardAnalyzer, 
POrterStemAnalyer and etc) is not thread safe. But I wonder if it's ok 
to share the same analyzer object within a thread. For example, if I 
want to create a PerFieldAnalyzer for 5 fields, can I use the same 
Analyzer object for all the fields? Or can both a QueryParser and 
Indexer/Searcher use the same Analyzer object?

Any comment?


Thanks!

Jay

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


Re: Analyzer sharing

Posted by Jiye Yu <yu...@AI.SRI.COM>.
I see.
I guess those Filters (e.g. PorterStemFilter) that make up the analyzer 
are not thread safe or cannot be shared.
Thanks for your quick response!

Jay

Yonik Seeley wrote:
> On 6/22/07, Jiye Yu <yu...@ai.sri.com> wrote:
>> I guess an Analyzer (built in ones such as StandardAnalyzer,
>> POrterStemAnalyer and etc) is not thread safe.
> 
> Analyzers *are* thread-safe.
> Multiple threads can all call analyzer.tokenStream() without any
> synchronization.
> 
> -Yonik
> 
> ---------------------------------------------------------------------
> 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


Re: Analyzer sharing

Posted by Yonik Seeley <yo...@apache.org>.
On 6/22/07, Jiye Yu <yu...@ai.sri.com> wrote:
> I guess an Analyzer (built in ones such as StandardAnalyzer,
> POrterStemAnalyer and etc) is not thread safe.

Analyzers *are* thread-safe.
Multiple threads can all call analyzer.tokenStream() without any
synchronization.

-Yonik

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