lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: UpdateIndex
Date Mon, 22 Aug 2005 16:55:28 GMT
Yes, this is not how you should do it.
Use reader.delete(Term) method to delete documents:
http://lucene.apache.org/java/docs/api/org/apache/lucene/index/IndexReader.html#delete(org.apache.lucene.index.Term)

Otis

--- dozean@gmx.de wrote:

> Hi,
> 
> i wrote an Index update, where first the IndexReader 
> delete all files from index which are changed.
> Than add documents which are not in the index!
> 
> Alone the deletion take so long, because i have 2 "for" loops!
> 
> file = array with all files in a directory
> 
> for (int i = 0; i<file.length; i++) {
> 	if (file[i].isFile()) {
>    for (int j =0; j<reader.numDocs(); j++) {
> 	if (file[i].getName() == reader.document(j).get("name") &&
> 	file[i].lastModified() >
> Integer.parseInt(reader.document(j).get("date")))
> {						reader.delete(j); 
>      }
> }
> 
> Maybe this is the wrong way?
> 
> Bye Derya
> 
> 
> -- 
> 5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
> +++ GMX - die erste Adresse für Mail, Message, More +++
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message