$deleteDocByQuery and $deleteDocByID

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

$deleteDocByQuery and $deleteDocByID

ejcirel
Does anyone have an example of how to use the $deleteDocByQuery and $deleteDocByID special commands.  I am not finding much online.  Any help would be greatly appreciated.  Thank you.

Erik
Reply | Threaded
Open this post in threaded view
|

Re: $deleteDocByQuery and $deleteDocByID

Sethi, Parampreet-2
Hi Erik,

Is this what you are looking for?
http://lucene.apache.org/solr/tutorial.html#Deleting+Data

Execute the following command to delete a document
 java -Ddata=args -Dcommit=no -jar post.jar
"<delete><id>SP2514N</id></delete>"


Š

Here is an example of using delete-by-query to delete anything with
      DDR <http://localhost:8983/solr/select?q=name:DDR&fl=name> in the
name:
 java -Ddata=args -jar post.jar "<delete><query>name:DDR</query></delete>"


In case you are using Solrj client or similar there are direct functions
available to modify the index (add/update/delete).

Hope it helps!

-param

On 2/1/12 11:14 AM, "ejcirel" <[hidden email]> wrote:

>Does anyone have an example of how to use the $deleteDocByQuery and
>$deleteDocByID special commands.  I am not finding much online.  Any help
>would be greatly appreciated.  Thank you.
>
>Erik
>
>--
>View this message in context:
>http://lucene.472066.n3.nabble.com/deleteDocByQuery-and-deleteDocByID-tp37
>07070p3707070.html
>Sent from the Solr - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

RE: $deleteDocByQuery and $deleteDocByID

Dyer, James
In reply to this post by ejcirel
Here is an example DIH entity that will delete from solr anything in the database that is not flagged as 'active'.

<entity
         name="Deletes"
         dataSource="ds"
         query="
                SELECT a.id AS '$deleteDocById'
                FROM products a
                INNER JOIN status_master sm on a.status_master_id = sm.status_master_id
                WHERE sm.status_master_value != 'Active' "
/>

There also was a bug, fixed in version 3.4, that would not commit automatically if only Deletes were processed in a DIH run.  See https://issues.apache.org/jira/browse/SOLR-2492 .

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: ejcirel [mailto:[hidden email]]
Sent: Wednesday, February 01, 2012 10:15 AM
To: [hidden email]
Subject: $deleteDocByQuery and $deleteDocByID

Does anyone have an example of how to use the $deleteDocByQuery and
$deleteDocByID special commands.  I am not finding much online.  Any help
would be greatly appreciated.  Thank you.

Erik

--
View this message in context: http://lucene.472066.n3.nabble.com/deleteDocByQuery-and-deleteDocByID-tp3707070p3707070.html
Sent from the Solr - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: $deleteDocByQuery and $deleteDocByID

ejcirel
In reply to this post by ejcirel
Thanks for answering Param, I appreciate it.  I am actually looking for a way to delete records when performing a full import to the index.  I am able to do it when issuing a delta import command by using the deletedPkQuery, but unfortnately the poor performance of the delta import prohibits me from doing so.  So I am using the full import command with clean=false to run a more efficient delta import, but can't figure out how to perform a delete during this operation.  Thanks for your time though, I really appreciate it.

Erik
Reply | Threaded
Open this post in threaded view
|

Re: $deleteDocByQuery and $deleteDocByID

Alan Rykhus
In reply to this post by Sethi, Parampreet-2
Hello Erik,

We are running jetty in the background and use curl and the following:

/usr/bin/curl -s http://127.0.0.1:8983/solr/biblio/update?commit=true -H
"Content-Type: text/xml" --data-binary
'<update><delete><query>ebr*</query></delete></update>';

/usr/bin/curl -s http://127.0.0.1:8983/solr/biblio/update?commit=true -H
"Content-Type: text/xml" --data-binary
'<update><delete><id>ebr10083687</id></delete></update>';

al

On Wed, 2012-02-01 at 16:54 +0000, Sethi, Parampreet wrote:

> Hi Erik,
>
> Is this what you are looking for?
> http://lucene.apache.org/solr/tutorial.html#Deleting+Data
>
> Execute the following command to delete a document
>  java -Ddata=args -Dcommit=no -jar post.jar
> "<delete><id>SP2514N</id></delete>"
>
>
> Š
>
> Here is an example of using delete-by-query to delete anything with
>       DDR <http://localhost:8983/solr/select?q=name:DDR&fl=name> in the
> name:
>  java -Ddata=args -jar post.jar "<delete><query>name:DDR</query></delete>"
>
>
> In case you are using Solrj client or similar there are direct functions
> available to modify the index (add/update/delete).
>
> Hope it helps!
>
> -param
>
> On 2/1/12 11:14 AM, "ejcirel" <[hidden email]> wrote:
>
> >Does anyone have an example of how to use the $deleteDocByQuery and
> >$deleteDocByID special commands.  I am not finding much online.  Any help
> >would be greatly appreciated.  Thank you.
> >
> >Erik
> >
> >--
> >View this message in context:
> >http://lucene.472066.n3.nabble.com/deleteDocByQuery-and-deleteDocByID-tp37
> >07070p3707070.html
> >Sent from the Solr - User mailing list archive at Nabble.com.
>

--
Alan Rykhus
PALS, A Program of the Minnesota State Colleges and Universities
(507)389-1975
[hidden email]
"It's hard to lead a cavalry charge if you think you look funny on a
horse" ~ Adlai Stevenson

Reply | Threaded
Open this post in threaded view
|

RE: $deleteDocByQuery and $deleteDocByID

ejcirel
In reply to this post by Dyer, James
Thanks James, I appreciate you taking the time to answer my question.  I'll give this a shot.

Erik
Reply | Threaded
Open this post in threaded view
|

Re: $deleteDocByQuery and $deleteDocByID

ejcirel
In reply to this post by Alan Rykhus
Thanks Alan, going to try this as well.  Thanks for taking the time to answer.

Erik
Reply | Threaded
Open this post in threaded view
|

Re: $deleteDocByQuery and $deleteDocByID

Paresh
Hi Erik,

I am also looking for some example of deleteDocByQuery. Here is my
requirement -

I want to do the database query and get the list of values of which matching
documents should be deleted from Solr.

I want to delete the docs which matches following query
    SolrColumnName:<value>

This <value> will come from query executed on RDBMS -
    select columnName from Table where state = 'deleted'

This columnName is the value populated in Solr for SolrColulmnName.

Regards,
Paresh



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: $deleteDocByQuery and $deleteDocByID

Paresh
Hi,

I am able to get it done using following way -

<entity name="delete_from_index" pk="ID" transformer="TemplateTransformer"
        query="SELECT dbColumnName FROM dbTableName where pstate = 1 AND
                  plast_modified_date &gt; TO_DATE
('${dih.last_index_time}','YYYY-MM-DD HH24:MI:SS')" >
            <field column="$deleteDocByQuery"
                template="solrFieldName:${delete_from_index.dbColumnName}"/>
            <field column="ID" name="id"/>
            <field column="dbColumnName" name="solrFieldName"/>
</entity>

Thanks,
Paresh



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: $deleteDocByQuery and $deleteDocByID

Dominique Bejean
In reply to this post by Paresh
Hi Paresh,

Due to deleteDocByQuery impact on commits and searcher reopen, if a lot of
deletions are done it is preferable when possible to use deletebyid .

Regards

Dominique

Le mar. 12 nov. 2019 à 07:03, Paresh <[hidden email]> a écrit :

> Hi Erik,
>
> I am also looking for some example of deleteDocByQuery. Here is my
> requirement -
>
> I want to do the database query and get the list of values of which
> matching
> documents should be deleted from Solr.
>
> I want to delete the docs which matches following query
>     SolrColumnName:<value>
>
> This <value> will come from query executed on RDBMS -
>     select columnName from Table where state = 'deleted'
>
> This columnName is the value populated in Solr for SolrColulmnName.
>
> Regards,
> Paresh
>
>
>
> --
> Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>