Does your analyser lower case things by any chance? If so that delete will never find anything to delete...
Dawn On 13/12/2011 15:44, gubs wrote:
Hi, I created a new document with 2 fields below code. String[] names = {"Gubendran", "kavitha"}; for ( String name : names) { luceneIndexWriter.createDocument(iw, name); } private void createDocument(IndexWriter iw, String name) throws CorruptIndexException, IOException { // Creating document to add using indexWriter Document doc = new Document(); Field nameField = new Field("name", name, Field.Store.YES, Field.Index.ANALYZED); // Add fields into document doc.add(nameField); iw.addDocument(doc); } Later used below code to delete document. But, when i do indexSearcher the data in document still exist. Any help ? // Delete the Document luceneIndexWriter.deleteDocument("Gubendran"); private void deleteDocument(String name) throws IOException { Directory dir = FSDirectory.open(new File(INDEX_DIR)); IndexReader ir = IndexReader.open(dir, false); ir.deleteDocuments(new Term("name", "Gubendran")); ir.close(); } Thanks and i appreciate Gubs
-- Rgds. *Dawn Raison*