Hallo Kapil;

thanks for your quick answer:
* "An IndexReader can be opened on a directory for which an IndexWriter
is opened already, but it cannot be used to delete documents from the
index then. "
sounded like a match, but I checked that and the IndexWriter is definitely
closed.

Regards,
Eric



Chhabra, Kapil wrote:
> 
> Hi,
> Checkout for the following lines in the documentation of IndexReader:
> 
> * "An IndexReader can be opened on a directory for which an IndexWriter
> is opened already, but it cannot be used to delete documents from the
> index then. "
> * "Once a document is deleted it will not appear in TermDocs or
> TermPostitions enumerations. Attempts to read its field with the
> document(int)  method will result in an error. The presence of this
> document may still be reflected in the
> docFreq(org.apache.lucene.index.Term) statistic, though this will be
> corrected eventually as the index is further modified."
> 
> Hope this helps.
> 
> Regards,
> kapilChhabra
> 
> 
> -----Original Message-----
> From: flateric [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 19, 2007 3:46 AM
> To: java-user@lucene.apache.org
> Subject: neither IndexWriter nor IndexReader would delete documents
> 
> 
> Hallo *;
> 
> I went through some examples of the Lucene in Action book to find that
> the API has changed and then applied the corrections with the help of
> this forum.
> One runtime problem however remains. I cannot delete any documents.
> I store documents like this:
> 
> IndexWriter iw = new IndexWriter(
>       new File(Constants.INDEX_FILENAME), new StandardAnalyzer());
> Document document = new Document(); ...
> document.add(new Field("doc", doc, Field.Store.YES, Field.Index.NO));
> iw.addDocument(document); iw.optimize(); iw.close(); 
> 
> Which works fine. But deleting them like this:
> 
> Directory fsDir = FSDirectory.getDirectory(new File(
>       Constants.INDEX_FILENAME));
> IndexReader ir = IndexReader.open(fsDir); ir.deleteDocuments(new
> Term("uid", uid)); ir.close();
> 
> Has absolutely no effect. I also tried delete on the IndexWriter - no
> effect.
> Please help! I don't know where to investigate any further!
> 
> Thx Eric
> --
> View this message in context:
> http://www.nabble.com/neither-IndexWriter-nor-IndexReader-would-delete-d
> ocuments-tf4832123.html#a13824599
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/neither-IndexWriter-nor-IndexReader-would-delete-documents-tf4832123.html#a13833730
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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

Reply via email to