WalterFox
WalterFox

Reputation: 1

ReuseStrategy in Lucene 4.0

I'm creating my own analyzer that is based on StopWordAnalyzerBase.

In order to make function AddDocument as it was in 3.0, I need to change ReuseStrategy according to Lucene Documentation. But I don't really understand how to do so, because my analyzer has no methods that allow strategy change.

Upvotes: 0

Views: 18

Answers (1)

NightOwl888
NightOwl888

Reputation: 56849

To change the reuse strategy, you must pass it to the constructor of the Analyzer class. StopwordAnalyzerBase doesn't expose this constructor, so you must subclass Analyzer directly and copy anything you need from the StopwordAnalyzerBase into your implementation.

You can either use Analyzer.GLOBAL_REUSE_STRATEGY, Analyzer.PER_FIELD_REUSE_STRATEGY, or subclass ReuseStrategy to implement your own logic.

Upvotes: 0

Related Questions