Re: Deleting document from index

2002-06-22 Thread Otis Gospodnetic

Hello,

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

--- [EMAIL PROTECTED] 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 ?

http://www.jguru.com/faq/view.jsp?EID=492423


public int delete(final String fieldName, final String fieldValue)
throws IOException
{
final IndexReader reader = IndexReader.open(mIndexDir);
final int deleteCount= reader.delete(new Term(fieldName,
fieldValue));
reader.close();
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 ?

Yes.

Otis


__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Deleting document from index

2002-06-21 Thread amitb

Hi,

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. 

1) Can anyone help us on how we can handle this ?
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 ?
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 ?

TIA  Regards,
-Amit

Sun Certified Programmer for Java2 Platform
Sansui Software Pvt. Ltd. Pune , India