lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guilherme Barile <...@prosoma.com.br>
Subject Re: IndexReader.delete(int docNum)
Date Thu, 22 May 2003 15:06:29 GMT
You could list all documents like

IndexReader reader = IndexReader.open(this.indexDir);
Document doc;
Vector v;        
for (int i = 0; i < reader.maxDoc(); i++) {
        try {
                doc = reader.document(i);
                v.add(doc.get("somefield"));
        }
        catch (Exception e) {
                System.out.println("Error getting doc " + i);
        }
}

This way the Vector v would contain all documents, and their index in v
would be the same as their index in lucene (I'm using this vector to
populate a JList).
Read the messages about "query matching all documents", we discussed
many stuff about this there.

see ya

gui

On Thu, 2003-05-22 at 11:49, Marie-Hélène Forget wrote:
> Hi,
> 
> I am trying to write a delete method using delete(int docNum) from the
> IndexReader class. The problem is that I don't know how to get the
> docNum parameter. Can you please help me.
> 
> My idea was to perform a search and to delete the documents found. Is
> that possible or is there another way around ?
> 
> PS: I tried to use delete(Term term), but it did not work. The document
> was not deleted.
> 
> Thanks for your help:)
> 
> MHF
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


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


Mime
View raw message