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

Search does not respect limit when objects are published in multiple locations

    XMLWordPrintable

Details

    Description

      We have objects published in multiple locations, when we search for objects, in the subtree of the root, an incorrect number of results are returned using:

      $searchService->findContent( $query );

      For example, the query below is generated and results in only 4 objects being returned:

      mysql> SELECT `ezcontentobject`.`id`, `sort_table_0`.`sort_key_int` AS `sort_column_0`, `sort_table_0`.`sort_key_string` AS `sort_column_0_bis` FROM `ezcontentobject` INNER JOIN ezcontentobject_version ON ezcontentobject.id = ezcontentobject_version.contentobject_id INNER JOIN `ezcontentobject_attribute` AS `sort_table_0` ON ( `sort_table_0`.`contentobject_id` = `ezcontentobject`.`id` AND `sort_table_0`.`version` = `ezcontentobject`.`current_version` AND ( ( `sort_table_0`.`language_id` & -2 ) & `ezcontentobject`.`initial_language_id` ) > 0 ) INNER JOIN `ezcontentclass_attribute` AS `cc_attr_0` ON ( `sort_table_0`.`contentclassattribute_id` = `cc_attr_0`.`id` AND `cc_attr_0`.`identifier` = 'publish_on' AND `cc_attr_0`.`version` = 0 ) INNER JOIN `ezcontentclass` AS `cc_0` ON ( `cc_attr_0`.`contentclass_id` = `cc_0`.`id` AND `cc_0`.`identifier` = 'magazine_article' AND `cc_0`.`version` = 0 ) LEFT JOIN `ezcontentobject_tree` AS `532b8cd6dfbea` ON `532b8cd6dfbea`.`contentobject_id` = `ezcontentobject`.`id` WHERE ( ( `ezcontentobject`.`contentclass_id` IN ( SELECT `id` FROM `ezcontentclass` WHERE `identifier` IN ( 'magazine_article' ) ) AND `532b8cd6dfbea`.`path_string` LIKE '/1/2/15622/111/%' AND NOT ( `ezcontentobject`.`id` IN ( 59449 ) ) AND ( `ezcontentobject`.`section_id` IN ( '1' ) OR ( `ezcontentobject`.`contentclass_id` IN ( '26', '27', '35', '37' ) AND `ezcontentobject`.`section_id` IN ( '3' ) ) OR `ezcontentobject`.`section_id` IN ( '3', '1' ) ) ) AND ezcontentobject_version.status = 1 ) ORDER BY `sort_column_0` DESC, `sort_column_0_bis` DESC LIMIT 10 OFFSET 0;
      +-------+---------------+-------------------+
      | id    | sort_column_0 | sort_column_0_bis |
      +-------+---------------+-------------------+
      | 64971 |    1394806560 |                   |
      | 64971 |    1394806560 |                   |
      | 64971 |    1394806560 |                   |
      | 64970 |    1394806500 |                   |
      | 64970 |    1394806500 |                   |
      | 34566 |    1394128800 |                   |
      | 34566 |    1394128800 |                   |
      | 34566 |    1394128800 |                   |
      | 34568 |    1394128740 |                   |
      | 34568 |    1394128740 |                   |
      +-------+---------------+-------------------+
      10 rows in set (0.19 sec)

      This is because of EzcDatabase::getContentIds, shouldn't this have the following?

              $query->groupBy(
                  $this->handler->quoteColumn( 'id', 'ezcontentobject' )
              );
      

      We have applied the pull request in EZP-21906 and this seems related

      Attachments

        Activity

          People

            Unassigned Unassigned
            43f49ffc-cd9b-4f81-a89b-a0d2f59e446c@accounts.ibexa.co Rob Clews
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: