lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew York" <matthew.y...@kcsplc.com>
Subject SpellChecker
Date Fri, 18 Aug 2006 06:46:38 GMT
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message