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 Alexander Ramos Jardim <al...@gmail.com> on 2008/10/27 14:21:56 UTC

Delete by query isn't working for a specific query

Hey pals,

I am trying to delete a couple documents that don't have any value on a
given integer field. This is the command I am executing:

$curl http://<host>:<port>/solr/update -H 'Content-Type:text/xml' -d
'<delete><query>-(deptId:[1 TO *])</query></delete>'
$curl http://<host>:<port>/solr/update -H 'Content-Type:text/xml' -d
'<commit/>'

But the documents don't get deleted.

Solr doesn't return any error message, its log seems ok. Any idea?
-- 
Alexander Ramos Jardim

Re: Delete by query isn't working for a specific query

Posted by Mark Miller <ma...@gmail.com>.
Alexander Ramos Jardim wrote:
> Hey pals,
>
> I am trying to delete a couple documents that don't have any value on a
> given integer field. This is the command I am executing:
>
> $curl http://<host>:<port>/solr/update -H 'Content-Type:text/xml' -d
> '<delete><query>-(deptId:[1 TO *])</query></delete>'
> $curl http://<host>:<port>/solr/update -H 'Content-Type:text/xml' -d
> '<commit/>'
>
> But the documents don't get deleted.
>
> Solr doesn't return any error message, its log seems ok. Any idea?
>   
I think deletebyquery uses the Lucene query parser right? So you can't 
do a pure negative query - gotto do a matchall first.

- Mark

Re: Delete by query isn't working for a specific query

Posted by Alexander Ramos Jardim <al...@gmail.com>.
Thank you both for your nice answers. I will try it out.

2008/10/27 Erik Hatcher <er...@ehatchersolutions.com>

> I don't think delete-by-query supports purely negative queries, even though
> they are supported for q and fq parameters for searches.
>
> Try using:
>
>   *:* AND -deptId:[1 TO *]
>
>        Erik
>
>
> On Oct 27, 2008, at 9:21 AM, Alexander Ramos Jardim wrote:
>
>  Hey pals,
>>
>> I am trying to delete a couple documents that don't have any value on a
>> given integer field. This is the command I am executing:
>>
>> $curl http://<host>:<port>/solr/update -H 'Content-Type:text/xml' -d
>> '<delete><query>-(deptId:[1 TO *])</query></delete>'
>> $curl http://<host>:<port>/solr/update -H 'Content-Type:text/xml' -d
>> '<commit/>'
>>
>> But the documents don't get deleted.
>>
>> Solr doesn't return any error message, its log seems ok. Any idea?
>> --
>> Alexander Ramos Jardim
>>
>
>


-- 
Alexander Ramos Jardim

Re: Delete by query isn't working for a specific query

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
I don't think delete-by-query supports purely negative queries, even  
though they are supported for q and fq parameters for searches.

Try using:

    *:* AND -deptId:[1 TO *]

	Erik

On Oct 27, 2008, at 9:21 AM, Alexander Ramos Jardim wrote:

> Hey pals,
>
> I am trying to delete a couple documents that don't have any value  
> on a
> given integer field. This is the command I am executing:
>
> $curl http://<host>:<port>/solr/update -H 'Content-Type:text/xml' -d
> '<delete><query>-(deptId:[1 TO *])</query></delete>'
> $curl http://<host>:<port>/solr/update -H 'Content-Type:text/xml' -d
> '<commit/>'
>
> But the documents don't get deleted.
>
> Solr doesn't return any error message, its log seems ok. Any idea?
> -- 
> Alexander Ramos Jardim