That'll work, but you could just as easily simply add the document. Solr will take care of deleting any other documents with the same <uniqueKey> as a document being added automatically.
Optimizing once a day is reasonable, but note that about all you're doing here is reclaiming some space. So if you only do a few deletes a day (by a few I'm thinking several thousand), you may be able to reduce that to once a week. But there's no particular reason to make it less frequent if you're satisfied with how it works now. Best Erick On Sat, Jun 18, 2011 at 11:54 PM, Mohammad Shariq <shariqn...@gmail.com> wrote: > I have define <uniqueKey> in my solr and Deleting the docs from solr using > this uniqueKey. > and then doing optimization once in a day. > is this right way to delete ??? > > On 19 June 2011 05:14, Erick Erickson <erickerick...@gmail.com> wrote: > >> Yep, you've got to delete and re-add. Although if you have a >> <uniqueKey> defined you >> can just re-add that document and Solr will automatically delete the >> underlying >> document. >> >> You might have to optimize the index afterwards to get the data to really >> disappear since the deletion process just marks the document as >> deleted. >> >> Best >> Erick >> >> On Sat, Jun 18, 2011 at 1:20 PM, Gabriele Kahlout >> <gabri...@mysimpatico.com> wrote: >> > Hello, >> > >> > I've indexing with the content field stored. Now I'd like to delete all >> > stored content, is there how to do that without re-indexing? >> > >> > It seems not from lucene >> > FAQ< >> http://wiki.apache.org/lucene-java/LuceneFAQ#How_do_I_update_a_document_or_a_set_of_documents_that_are_already_indexed.3F >> > >> > : >> > How do I update a document or a set of documents that are already >> > indexed? There >> > is no direct update procedure in Lucene. To update an index incrementally >> > you must first *delete* the documents that were updated, and *then >> > re-add*them to the index. >> > >> > -- >> > Regards, >> > K. Gabriele >> > >> > --- unchanged since 20/9/10 --- >> > P.S. If the subject contains "[LON]" or the addressee acknowledges the >> > receipt within 48 hours then I don't resend the email. >> > subject(this) ∈ L(LON*) ∨ ∃x. (x ∈ MyInbox ∧ Acknowledges(x, this) ∧ >> time(x) >> > < Now + 48h) ⇒ ¬resend(I, this). >> > >> > If an email is sent by a sender that is not a trusted contact or the >> email >> > does not contain a valid code then the email is not received. A valid >> code >> > starts with a hyphen and ends with "X". >> > ∀x. x ∈ MyInbox ⇒ from(x) ∈ MySafeSenderList ∨ (∃y. y ∈ subject(x) ∧ y ∈ >> > L(-[a-z]+[0-9]X)). >> > >> > > > > -- > Thanks and Regards > Mohammad Shariq >