Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-381

delete-by-query does not support purely negative queries

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.0
    • update
    • None

    Description

      Reported by Rob Casson:

      indexing the example docs from 1.2, these steps work:
      
      curl http://localhost:8983/solr/update --data-binary
      '<delete><query>solr</query></delete>' -H 'Content-type:text/xml;
      charset=utf-8'
      
      curl http://localhost:8983/solr/update --data-binary '<optimize />' -H
      'Content-type:text/xml; charset=utf-8'
      
      but if i reindex, and change the delete query to a negative, the
      non-'solr' docs don't get deleted:
      
      curl http://localhost:8983/solr/update --data-binary
      '<delete><query>-solr</query></delete>' -H 'Content-type:text/xml;
      charset=utf-8'
      
      curl http://localhost:8983/solr/update --data-binary '<optimize />' -H
      'Content-type:text/xml; charset=utf-8'
      
      And detailed by Hoss with a workaround:
      the delete by query does "the 
      right thing" with a purely negative query ... when the customization was 
      added to Solr to support pure negative queries it was done at the 
      SolrIndexSearcher level when computing DocSets, but delete by query uses a 
      lower level method passing in a HitCOllector.
      
      the work arround is to include *:* in yoru query ...
         <delete><query>*:* -solr</query></delete>
      ... if/when this is fixed 
      in Solr that's esentally what solr will do under the covers.
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            ehatcher Erik Hatcher
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: