Solr
  1. Solr
  2. SOLR-381

delete-by-query does not support purely negative queries

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Component/s: update
    • Labels:
      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.
      

        Activity

        Hide
        Uwe Schindler added a comment -

        Closed after release.

        Show
        Uwe Schindler added a comment - Closed after release.
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Chris M. Hostetter
        http://svn.apache.org/viewvc?view=revision&revision=1441155

        SOLR-381: test demonstrating deleteByQuery works with pure-negative queries, and QParsers in general (merge r1441154)

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Chris M. Hostetter http://svn.apache.org/viewvc?view=revision&revision=1441155 SOLR-381 : test demonstrating deleteByQuery works with pure-negative queries, and QParsers in general (merge r1441154)
        Hide
        Hoss Man added a comment -

        This appears to have been fixed in 4.0, i've added a test to verify no regressions moving forward...

        Committed revision 1441154.
        Committed revision 1441155.

        Show
        Hoss Man added a comment - This appears to have been fixed in 4.0, i've added a test to verify no regressions moving forward... Committed revision 1441154. Committed revision 1441155.
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] Chris M. Hostetter
        http://svn.apache.org/viewvc?view=revision&revision=1441154

        SOLR-381: test demonstrating deleteByQuery works with pure-negative queries, and QParsers in general

        Show
        Commit Tag Bot added a comment - [trunk commit] Chris M. Hostetter http://svn.apache.org/viewvc?view=revision&revision=1441154 SOLR-381 : test demonstrating deleteByQuery works with pure-negative queries, and QParsers in general
        Hide
        Hoss Man added a comment -

        updating summary to use jira's noformat tag so that it doesn't interpret the query syntax as wiki markup

        Daivd: this issue was open before wiki markup was supported in issue summaries, so jira was showing you {{ : }} when it should have been showing you {{ *:* }}

        Show
        Hoss Man added a comment - updating summary to use jira's noformat tag so that it doesn't interpret the query syntax as wiki markup Daivd: this issue was open before wiki markup was supported in issue summaries, so jira was showing you {{ : }} when it should have been showing you {{ *:* }}
        Hide
        David Peterson added a comment -

        The workaround gives a syntax error.

        java -Ddata=args -jar /opt/solr/example/exampledocs/post.jar ": -userid:*"
        java -jar /opt/solr/example/exampledocs/post.jar *.xml

        SimplePostTool: version 1.4
        SimplePostTool: POSTing args to http://localhost:8983/solr/update..
        SimplePostTool: FATAL: Solr returned an error #400 Error parsing Lucene query SimplePostTool: version 1.4

        Show
        David Peterson added a comment - The workaround gives a syntax error. java -Ddata=args -jar /opt/solr/example/exampledocs/post.jar ": -userid:*" java -jar /opt/solr/example/exampledocs/post.jar *.xml SimplePostTool: version 1.4 SimplePostTool: POSTing args to http://localhost:8983/solr/update .. SimplePostTool: FATAL: Solr returned an error #400 Error parsing Lucene query SimplePostTool: version 1.4

          People

          • Assignee:
            Unassigned
            Reporter:
            Erik Hatcher
          • Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development