incubator-lucy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From goran kent <>
Subject [lucy-user] Replacing a document in an index
Date Fri, 21 Oct 2011 18:21:20 GMT

I need to replace a few documents in various indexes and need a bit of
clarification on the best procedure.

Can I delete doc/add doc (in effect replacing) in one go?:

my $index = Lucy::Index::Indexer->new(...create=>0...);
# delete existing:
$index->delete_by_term(field=>'docid', term=>$docid);
# add new:

The man page for Lucy::Index::Indexer(3) states:

"Note: at present, delete_by_term() and delete_by_query() only affect
documents which had been previously committed to the index -- and not
any documents added this indexing session but not yet committed.  This
may change in a future update."

I understand this as meaning I cannot add $docid, then try and delete
the same $docid in the same session (ie, between new() and commit()).
Since I'm deleting a previously committed document, and re-adding it,
I should be ok...

Is my understanding correct?

Finally, I read in the docs somewhere that delete_by_term() will only
flag a doc as deleted (so it's ignored during searches), but since
commit() is being called, will the deleted doc be physically removed
as well?


View raw message