lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <>
Subject Re: Deleting document from index
Date Sat, 22 Jun 2002 13:31:11 GMT

First of all, the machine from which you sent this email has the date
set incorrectly - it thinks it's 22. 6. 2000.

--- wrote:

> I had searched the archive of this list for getting more info on "How
> to delete a document from the lucene index".
> But most of the postings talk about IndexReader.delete(docNum). When
> we tried to delete a single document entry from the index , what we
> found is : the whole index got deleted. 

You must be doing something wrong.  Send the relevant piece of code.

> 1) Can anyone help us on how we can handle this ?

    public int delete(final String fieldName, final String fieldValue)
        throws IOException
        final IndexReader reader =;
        final int deleteCount    = reader.delete(new Term(fieldName,
        return deleteCount;

> 2) When the search results will reflect that, the particular document
> which I had deleted ,is not there ?
> Do I need to "optimize" the index for this ?

You don't need to optimize the index, but I believe you need to close
the IndexReader and re-open IndexSearcher when you detect that the
index has changed.

> 3) After adding few more documents to an existing index, what effect
> will it have on search , if I don't optimize
> the index immediately ? Will these new documents will be searchable
> before optimization ?



Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message