Lucene.NET, StandardAnalyzer, Stop Words and Thread Safety

When the code runs below, I assume that the stop word file is read from the file system every time the request is parsed. Instead, can I reuse the same analyzer instance instead of creating a new one? Is it thread safe? (After long searches I can not find information about this)

var stopwordsFile = new FileInfo("C:\MyStopWordsFile.txt");
var analyzer = new StandardAnalyzer(stopwordsFile);
var queryParser = new QueryParser("", analyzer);
var query = queryParser.Parse(stringToParse);
+5
source share
1 answer

The docs state that only static instances of StandardAnalyzer are thread safe. QueryParser is the same.

+3
source

All Articles