我试图让一组用下面的代码文件的TF:getTermFreqVector() - NullPointerException异常
IndexReader r = IndexReader.open(FSDirectory.open(new File("index")));
TermFreqVector tfv = r.getTermFreqVector(root[i],"contents"); // where root[] contains the
document IDs of the documents in my corpus
我不断收到一个空指针异常。任何人都可以告诉我这里可能有什么问题吗? 我正在使用Lucene 3.6.2,是否有无论如何确保termFreqVector在索引时启用?
请包括错误的堆栈跟踪。你有没有试过用调试器来检查r和root是否为空? – eldris 2013-04-20 20:44:44
确保在建立索引时启用termfreqvector信息。你可以检查使用卢克或索引源代码 – phani 2013-04-20 21:08:27
嘿,你有没有解决这个问题?我自己也遇到同样的问题。我很确定我的术语向量被正确索引,但我看到一个NPE。 – Kmanc 2014-07-09 00:46:38