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 Massimo Schiavon <ms...@volunia.com> on 2011/09/15 12:53:04 UTC

Delete documents with empty fields

I want to delete all documents with empty title field.
If i run the query -title:[* TO *] I obtain the correct list of 
documents but when I submit to solr the delete command:

curl http://localhost:8080/solr/web/update\?commit=true -H 
'Content-Type: text/xml' --data-binary \
'<delete><query>-title:[* TO *]</query></delete>'

none of the documents were deleted.

After a bit of debugging I have noted that the query was internally 
rewritten by org.apache.lucene.search.Searcher.createNormalizedWeight to 
an empty query.

It is a bug or there is another way to do this operation? (or there is 
no way?)


Regards

Massimo

Re: Delete documents with empty fields

Posted by Massimo Schiavon <ms...@volunia.com>.
On 15/09/2011 13:01, Ahmet Arslan wrote:
> +*:* -title:[* TO *]

Worked fine.
Thanks a lot!


Massimo

Re: Delete documents with empty fields

Posted by Ahmet Arslan <io...@yahoo.com>.
> I want to delete all documents with
> empty title field.
> If i run the query -title:[* TO *] I obtain the correct
> list of documents but when I submit to solr the delete
> command:
> 
> curl http://localhost:8080/solr/web/update\?commit=true -H
> 'Content-Type: text/xml' --data-binary \
> '<delete><query>-title:[* TO
> *]</query></delete>'
> 
> none of the documents were deleted.
> 
> After a bit of debugging I have noted that the query was
> internally rewritten by
> org.apache.lucene.search.Searcher.createNormalizedWeight to
> an empty query.
> 
> It is a bug or there is another way to do this operation?
> (or there is no way?)

Not sure but '<delete><query>+*:* -title:[* TO *]</query></delete>' may do the trick.