Hi, I'm having issues creating a SpellChecker index.

I am running JRE 1.5.0_06, and have the following in my classpath - 
lucene-core-2.0.0.jar & lucene-spellchecker-2.0.0.jar.

When I run the code below I get the following exception and a 1KB segments file 
in the spellIndexDirectoryPath:

Exception in thread "main" java.lang.NullPointerException
        at 
org.apache.lucene.search.spell.SpellChecker.indexDictionary(SpellChecker.java:298)
        at com.kcs.pi.Search.main(Search.java:49)

Any help would be appreciated. Thanks


IndexWriter writer = new IndexWriter(originalIndexDirectoryPath, new 
StandardAnalyzer(), true);
Document doc = new Document();
doc.add(new Field("contents",   "seventy", Field.Store.YES, 
Field.Index.TOKENIZED));
writer.addDocument(doc);
writer.optimize();
writer.close();
                        
FSDirectory originalIndexDirectory = 
FSDirectory.getDirectory(originalIndexDirectoryPath, false);
FSDirectory spellIndexDirectory = 
FSDirectory.getDirectory(spellIndexDirectoryPath, true);
IndexReader indexReader = IndexReader.open(originalIndexDirectory);
Dictionary dictionary = new LuceneDictionary(indexReader,"contents");
                        
SpellChecker spellChecker = new SpellChecker(spellIndexDirectory);
spellChecker.indexDictionary(dictionary);
indexReader.close();






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to