Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-22830

Solr Storage: having query with LogicalNot generating subquery returns empty result set

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • 5.3
    • 5.3-dev
    • Search

    Description

      PHP query:

      array(
          'filter' => new Criterion\LogicalAnd(
              array(
                  new Criterion\ContentId(
                      array( 1, 4, 10 )
                  ),
                  new Criterion\LogicalNot(
                      new Criterion\ContentId(
                          array( 10, 12 )
                      )
                  ),
              )
          ),
      ),
      

      will generate following Solr query:

      ((id:"1" OR id:"4" OR id:"10") AND NOT ((id:"10" OR id:"12")))

      That will work as expected. However, PHP query:

      array(
          'filter' => new Criterion\LogicalAnd(
              array(
                  new Criterion\ContentId(
                      array( 1, 4, 10 )
                  ),
                  new Criterion\LogicalAnd(
                      array(
                          new Criterion\LogicalNot(
                              new Criterion\ContentId(
                                  array( 10, 12 )
                              )
                          ),
                      )
                  ),
              )
          ),
      ),
      

      will create following Solr query:

      ((id:"1" OR id:"4" OR id:"10") AND (NOT ((id:"10" OR id:"12"))))

      Which will not work as expected. Reason for this is that LogicalNot now produces pure negative subquery, which will not match anything.

      Proposed fix:

      make LogicalNot always produce positive query, for example:

      ((id:"1" OR id:"4" OR id:"10") AND (*:* NOT ((id:"10" OR id:"12"))))

      Attachments

        Activity

          People

            Unassigned Unassigned
            petar.spanja-obsolete@ez.no Petar Spanja (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h