Here's the problem: the standard Solr parser is a little weird about
negative queries. The way to make this work is to say
    *:* AND -field:[* TO *]

This means "select everything AND only these documents without a value
in the field".

On Wed, Aug 25, 2010 at 7:55 PM, Max Lynch <ihas...@gmail.com> wrote:
> I was trying to filter out all documents that HAVE that field.  I was trying
> to delete any documents where that field had empty values.
>
> I just found a way to do it, but I did a range query on a string date in the
> Lucene DateTools format and it worked, so I'm satisfied.  However, I believe
> it worked because all of my documents have values for that field.
>
> Oh well.
>
> -max
>
> On Wed, Aug 25, 2010 at 9:45 PM, scott chu (朱炎詹) 
> <scott....@udngroup.com>wrote:
>
>> Excuse me, what's the hyphen before  the field name 'date_added_solr'? Is
>> this some kind of new query format that I didn't know?
>>
>> <delete><query>-date_added_solr:[* TO *]</query></delete>'
>>
>> ----- Original Message -----
>> From: "Max Lynch" <ihas...@gmail.com>
>> To: <solr-user@lucene.apache.org>
>> Sent: Thursday, August 26, 2010 6:12 AM
>> Subject: Delete by query issue
>>
>>
>> > Hi,
>> > I am trying to delete all documents that have null values for a certain
>> > field.  To that effect I can see all of the documents I want to delete by
>> > doing this query:
>> > -date_added_solr:[* TO *]
>> >
>> > This returns about 32,000 documents.
>> >
>> > However, when I try to put that into a curl call, no documents get
>> deleted:
>> > curl http://localhost:8985/solr/newsblog/update?commit=true -H
>> > "Content-Type: text/xml" --data-binary
>> '<delete><query>-date_added_solr:[*
>> > TO *]</query></delete>'
>> >
>> > Solr responds with:
>> > <response>
>> > <lst name="responseHeader"><int name="status">0</int><int
>> > name="QTime">364</int></lst>
>> > </response>
>> >
>> > But nothing happens, even if I explicitly issue a commit afterward.
>> >
>> > Any ideas?
>> >
>> > Thanks.
>> >
>>
>>
>>
>> --------------------------------------------------------------------------------
>>
>>
>>
>> %<&b6G$J0T.'$$'d(l/f,r!C
>> Checked by AVG - www.avg.com
>> Version: 9.0.851 / Virus Database: 271.1.1/3093 - Release Date: 08/25/10
>> 14:34:00
>>
>



-- 
Lance Norskog
goks...@gmail.com

Reply via email to