private static void doSpellCheckerIndexing(string LuceneIndexDir, string SpellCheckerIndexDir)
{
try
{
// http://lucene.apache.org/java/2_2_0/api/org/apache/lucene/search/spell/SpellChecker.html
FSDirectory spellCheckerIndexDir = FSDirectory.GetDirectory(SpellCheckerIndexDir, false);
FSDirectory indexDir = FSDirectory.GetDirectory(LuceneIndexDir, false);
SpellChecker.Net.Search.Spell.SpellChecker spellchecker = new SpellChecker.Net.Search.Spell.SpellChecker(spellCheckerIndexDir);
spellchecker.ClearIndex();
// SpellChecker.Net.Search.Spell.SpellChecker spellchecker = new SpellChecker.Net.Search.Spell.SpellChecker (global::Lucene.Net.Store.Directory SpellChecker(spellIndexDirectory);
IndexReader r = IndexReader.Open(indexDir);
try
{
// To index a field of a user index:
Dictionary dict = new SpellChecker.Net.Search.Spell.LuceneDictionary(r, "title");
spellchecker.IndexDictionary(dict);
}
finally
{
r.Close();
}
}
catch (Exception ex)
{
Console.Write("Could not create spell-checking index" + ex.Message);
}
}