Fernando, this code seems okay, in what sense is it "not working well"?
One thing to verify is that the "contentPid" field you are deleting by was added to the index with Index.UN_TOKENIZED, otherwise the analyzer in use while indexing might have broken or lower-cased that term (e.g. "contentPid:C_1078") and in that case the delete-by-term would not delete anything. Deleting by term is a cleaner way to go, well, cleaner than deleting by id, but if you prefer, you can do a search for the appropriate term, extract the docid (or docids) from the search result, and then use the (same) reader to delete by docid. Make sure to use the same reader, because docids found in one reader are not necessarily valid in another reader. Fernando G Bernardino <[EMAIL PROTECTED]> wrote on 10/01/2007 09:48:53: > Hi People! > > My app needs to update documents from index, so I have to remove and > insert again, all right? > > First I wrote this code: > --- > IndexReader reader = null; > try > { > String index = Webp.getProperty("webp.search.indexFolder"); > Directory directory = FSDirectory.getDirectory(index, false); > > reader = IndexReader.open(directory); > reader.delete(new Term("contentPid", > String.valueOf("C_"+content.pidObject()))); > } > .... > --- > > But It's not working well.. I want to use de method 'reader.delete(int)' > but I can't discover the document 'ID' to use as parameter. > I wrote some code to return the documents that I have to delete. How can > I get that ID? > > Thanks! > > -- > Fernando Bernardino > > --------------------------------------------------------------------- > 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]