Lucene StandardAnalyzer using Hunspell TokenFilter in C#?

714 Views Asked by At

How can I add a TokenFilter to StandardAnalyzer in Lucene? Or is there another Analyzer that does the same thing, only allows me to also use a TokenFilter?

I have a TokenFilter for Hunspell in C# which I am not sure where/how to plug in the process of indexing?

var analyzer = new StandardAnalyzer(Version.LUCENE_29);

var indexExists = IndexReader.IndexExists(directory);
var createIndex = (indexExists == false);

var indexWriter = new IndexWriter(directory, analyzer, createIndex, IndexWriter.MaxFieldLength.UNLIMITED);

....

indexWriter.AddDocument(document);

And I have on the other hand:

HunspellStemFilter : TokenFilter

From:

http://devhost.se/blog/post/2011/04/07/C-port-of-lucene-hunspell.aspx

Can anyone help?

1

There are 1 best solutions below

0
On

There's an updated version with an example available at http://www.devhost.se/blog/post/2012/01/03/Updated-version-of-the-lucene-hunspell-port.aspx

You just swap out your StandardAnalyzer in your code with your new hunspell based analyzer.