开发者

Lucene - search works, but gives "UnsupportedOperationException" when deployed to Tomcat. Why?

The code under works when I run it as a java application locally, but "reader.directory()" gives "UnsupportedOperationException: This reader does not support this method." Someone have an idea why?

public ExternalSearch() {
  System.out.println("Initialize Lucene-Search");
  analyzer = new StandardAnalyzer(Version.LUCENE_20);

  File file = new File("index开发者_Go百科");

try {
   Directory dir = FSDirectory.open(file);
   reader = IntexReader.open(dir, true);
} catch (IOException e) {
   System.out.println("ERROR: Could not read index -> " + e.getMessage());
   e.printStackTrace();
}
this.index = reader.directory();

}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜