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();
}
精彩评论