请问LUCENE建立索引不是累增的吗,为什么每次建立索引后之前的就没有了呢
Document   doc   =   new   Document();    
 doc.add(new   Field( "title ",   title,Field.Store.YES,Field.Index.TOKENIZED));    
 doc.add(new   Field( "content ",   content,Field.Store.YES,Field.Index.TOKENIZED));    
 doc.add(new   Field( "url ",   url,Field.Store.YES,Field.Index.NO)); 
 writer.addDocument(doc);   
 LUCENE   2.0的代码如上,为什么会覆盖原来的索引呢
------解决方案--------------------Document doc = new Document();  
 doc.add(new Field( "title ", title,Field.Store.YES,Field.Index.TOKENIZED));  
 doc.add(new Field( "content ", content,Field.Store.YES,Field.Index.TOKENIZED));  
 doc.add(new Field( "url ", url,Field.Store.YES,Field.Index.NO)); 
 writer.addDocument(doc);   
 这个只是做索引,至于你是要覆盖原索引文件还是要继续添加到原有索引中,看下面这个接口: 
 public IndexWriter(String path, Analyzer a, boolean create) 
 就是你writer.addDocument(doc)的定义的构造函数, 
 第三个参数,是指定你到底是"要覆盖原索引文件还是要继续添加到原有索引中" 
 具体看看javadoc吧. 
 lucene不适合初学java的人...