Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User
Deleted documents in the index.
 

Index | Next | Previous | View Flat


nageshblore at gmail

Jul 25, 2008, 4:17 AM


Views: 291
Permalink
Deleted documents in the index.

Hi,
I am writing a class to report on an index. This index has documents updated
using the IndexWriter.updateDocument(Term, Document) method. That is,
documents were deleted and added again. My aim is to see what documents (and
their fields) are present in the index. Since the document was updated (i.e.
deleted and added), it is marked as deleted and hence not able to obtain a
Document object for the updated document.

How do I report on such documents ?

for (int i = 1; i < numDocs; i++) {
//ir is an IndexReader object
if (ir.isDeleted(i)) {
bw.write("Document " + i + " has been deleted.");
bw.newLine();
} else {
Document d = getDocument(ir, i);

List<Field> l = d.getFields();
int numFields = l.size();
bw.write("Document has " + numFields + " fields as
follows");
bw.newLine();

for (int j = 0; j < numFields; j++) {
String fieldName = l.get(j).name();
bw.write("\t Field : " + fieldName + " Value : "
+ d.getField(fieldName).stringValue());
bw.newLine();
}
}
}

Subject User Time
Deleted documents in the index. nageshblore at gmail Jul 25, 2008, 4:17 AM
    Deleted documents in the index. nageshblore at gmail Jul 25, 2008, 5:12 AM
    Re: Deleted documents in the index. lucene at mikemccandless Jul 25, 2008, 5:18 AM
    Re: Deleted documents in the index. nageshblore at gmail Jul 25, 2008, 5:44 AM
    Re: Deleted documents in the index. lucene at mikemccandless Jul 25, 2008, 6:47 AM
    Re: Deleted documents in the index. nageshblore at gmail Jul 25, 2008, 7:09 AM
    Re: Deleted documents in the index. nageshblore at gmail Jul 25, 2008, 7:56 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.