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 ejcirel <ej...@yahoo.com> on 2012/02/01 17:14:58 UTC

$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.

Re: $deleteDocByQuery and $deleteDocByID

Posted by ejcirel <ej...@yahoo.com>.
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

--
View this message in context: http://lucene.472066.n3.nabble.com/deleteDocByQuery-and-deleteDocByID-tp3707070p3707226.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: $deleteDocByQuery and $deleteDocByID

Posted by ejcirel <ej...@yahoo.com>.
Thanks James, I appreciate you taking the time to answer my question.  I'll
give this a shot.

Erik

--
View this message in context: http://lucene.472066.n3.nabble.com/deleteDocByQuery-and-deleteDocByID-tp3707070p3707263.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: $deleteDocByQuery and $deleteDocByID

Posted by "Dyer, James" <Ja...@ingrambook.com>.
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:ejcirel@yahoo.com] 
Sent: Wednesday, February 01, 2012 10:15 AM
To: solr-user@lucene.apache.org
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.

Re: $deleteDocByQuery and $deleteDocByID

Posted by Dominique Bejean <do...@eolya.fr>.
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 <kh...@gmail.com> 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
>

Re: $deleteDocByQuery and $deleteDocByID

Posted by Paresh <kh...@gmail.com>.
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

Re: $deleteDocByQuery and $deleteDocByID

Posted by Paresh <kh...@gmail.com>.
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

Re: $deleteDocByQuery and $deleteDocByID

Posted by Paresh <kh...@gmail.com>.
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

Re: $deleteDocByQuery and $deleteDocByID

Posted by ejcirel <ej...@yahoo.com>.
Thanks Alan, going to try this as well.  Thanks for taking the time to
answer.

Erik

--
View this message in context: http://lucene.472066.n3.nabble.com/deleteDocByQuery-and-deleteDocByID-tp3707070p3707266.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: $deleteDocByQuery and $deleteDocByID

Posted by Alan Rykhus <al...@mnsu.edu>.
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" <ej...@yahoo.com> 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
alan.rykhus@mnsu.edu
"It's hard to lead a cavalry charge if you think you look funny on a
horse" ~ Adlai Stevenson


Re: $deleteDocByQuery and $deleteDocByID

Posted by "Sethi, Parampreet" <pa...@teamaol.com>.
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" <ej...@yahoo.com> 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.