You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Pawan Darira <pa...@gmail.com> on 2010/08/25 05:56:38 UTC

How to delete documents from SOLR index using DIH

Hi

I am using data import handler to build index. How can i delete documents
from my index using DIH.

-- 
Thanks,
Pawan Darira

RE: How to delete documents from SOLR index using DIH

Posted by Ephraim Ofir <Ep...@icq.com>.
You have several options here:
1. Use the deletedPkQuery in delta import - you'll need to make a DB
query which generates the IDs to be deleted (something like: SELECT id
FROM your_table WHERE deleted = 1).
2. Add the $deleteDocById special command to your full/delta import.
3. Use preImportDeleteQuery/postImportDeleteQuery in your full/delta
query

If you want to use any of these separately from your import, you can put
them in a separate entity and do a full/delta import just on that
entity.

Ephraim Ofir


-----Original Message-----
From: Pawan Darira [mailto:pawan.darira@gmail.com] 
Sent: Thursday, August 26, 2010 9:01 AM
To: solr-user@lucene.apache.org
Subject: Re: How to delete documents from SOLR index using DIH

Thanks Erick. Your solution do make sense. Actually i wanted to know,
how to
use delete via query or unique id through DIH?

Is there any specific query to be mentioned in data-config.xml? Also Is
there any separate command like "full-import" ,"delta-import" for
deleting
documents from index?



On Thu, Aug 26, 2010 at 12:03 AM, Erick Erickson
<er...@gmail.com>wrote:

> I'm not sure what you mean here. You can delete via query or unique
id. But
> DIH really isn't relevant here.
>
> If you've defined a unique key, simply re-adding any changed documents
will
> delete the old one and insert the new document.
>
> If this makes no sense, could you explain what the underlying problem
> you're
> trying to solve is?
>
> HTH
> Erick
>
> On Tue, Aug 24, 2010 at 8:56 PM, Pawan Darira <pawan.darira@gmail.com
> >wrote:
>
> > Hi
> >
> > I am using data import handler to build index. How can i delete
documents
> > from my index using DIH.
> >
> > --
> > Thanks,
> > Pawan Darira
> >
>



-- 
Thanks,
Pawan Darira

Re: How to delete documents from SOLR index using DIH

Posted by "Grijesh.singh" <pi...@gmail.com>.
DIH is not basically for deletion it is for inserting data into index.
Although it has a parameter "clean" which is by default true and it cleans
the index every time when full-import command is issued, means it create
index from scratch. 

If your requirement is to delete whole index you can also use: 
http://localhost:8080/solr/update?stream.body=<delete><query>*:*</query></delete> 
http://localhost:8080/solr/update?stream.body=<commit/> 

If your requirement is to delete data from index selectively, change the
above query accordingly: 
http://localhost:8080/solr/update?stream.body=<delete><query>adId:1002</query></delete> 
http://localhost:8080/solr/update?stream.body=<commit/> 
-- 
View this message in context: http://lucene.472066.n3.nabble.com/How-to-delete-documents-from-SOLR-index-using-DIH-tp1323794p1346743.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to delete documents from SOLR index using DIH

Posted by Pawan Darira <pa...@gmail.com>.
Thanks Erick. Your solution do make sense. Actually i wanted to know, how to
use delete via query or unique id through DIH?

Is there any specific query to be mentioned in data-config.xml? Also Is
there any separate command like "full-import" ,"delta-import" for deleting
documents from index?



On Thu, Aug 26, 2010 at 12:03 AM, Erick Erickson <er...@gmail.com>wrote:

> I'm not sure what you mean here. You can delete via query or unique id. But
> DIH really isn't relevant here.
>
> If you've defined a unique key, simply re-adding any changed documents will
> delete the old one and insert the new document.
>
> If this makes no sense, could you explain what the underlying problem
> you're
> trying to solve is?
>
> HTH
> Erick
>
> On Tue, Aug 24, 2010 at 8:56 PM, Pawan Darira <pawan.darira@gmail.com
> >wrote:
>
> > Hi
> >
> > I am using data import handler to build index. How can i delete documents
> > from my index using DIH.
> >
> > --
> > Thanks,
> > Pawan Darira
> >
>



-- 
Thanks,
Pawan Darira

Re: How to delete documents from SOLR index using DIH

Posted by Erick Erickson <er...@gmail.com>.
I'm not sure what you mean here. You can delete via query or unique id. But
DIH really isn't relevant here.

If you've defined a unique key, simply re-adding any changed documents will
delete the old one and insert the new document.

If this makes no sense, could you explain what the underlying problem you're
trying to solve is?

HTH
Erick

On Tue, Aug 24, 2010 at 8:56 PM, Pawan Darira <pa...@gmail.com>wrote:

> Hi
>
> I am using data import handler to build index. How can i delete documents
> from my index using DIH.
>
> --
> Thanks,
> Pawan Darira
>