lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shashi Kant <sk...@sloan.mit.edu>
Subject Re: how to Index only newly added documents?
Date Wed, 04 Nov 2009 18:22:00 GMT
Like Simon mentioned you might want to create a document identifier or
UUID - if you don't have one already
and use this code snippet to check if doc exists:

 string doc_id = "1234567";
 Term idTerm = new Term(Fields.DOCID_FIELD,doc_id);
            if (mSearcher.docFreq(idTerm) > 0) {
                //mIndexWriter.updateDocument(idTerm,doc);
                //This document exists hence skip
            } else {
                mIndexWriter.addDocument(doc);
            }

Mime
View raw message