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

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 5.3-dev
    • Fix Version/s: 5.3
    • Component/s: Search
    • Labels:

      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

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              petar.spanja@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