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

Sorting in the default eZSearchEngine using PostgreSQL

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Medium Medium
    • None
    • 4.1.3
    • Search
    • None

    Description

      Hi there,
      I was trying to sort by attribute the results from a call to eZSearchEngine::search() when i noticed that no result were being sorted, so i went look for the sorting code and i noticed that there were a condition in the line 1034 "if ( $dbName == 'mysql' )" that constructs a query for mysql, and an else for all other RDBMS. And i noticed that sorting is only applied to the mysql query.
      For a working query with postgres i just added another condition for postgresql around line 1057:
      (sorry for not submiting a patch)

      (...)
      } elseif($dbName == 'postgresql')

      { $orderByFieldsSQL = preg_replace('/\s+desc|\s+asc/i', '', $orderByFieldsSQL); $searchQuery = "SELECT DISTINCT ezcontentobject.*, ezcontentclass.serialized_name_list as class_serialized_name_list, ezcontentobject_tree.*, $orderByFieldsSQL $versionNameTargets FROM $tmpTablesFrom $tmpTablesSeparator ezcontentobject, ezcontentclass, ezcontentobject_tree $versionNameTables $sortFromSQL WHERE $tmpTablesWhere $and $tmpTablesWhereExtra ezcontentobject.contentclass_id = ezcontentclass.id and ezcontentclass.version = '0' and ezcontentobject.id = ezcontentobject_tree.contentobject_id and ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id $versionNameJoins $showInvisibleNodesCond $sortWhereSQL ORDER BY $orderByFieldsSQL"; }

      else
      {
      (...)

      Attachments

        Activity

          People

            unknown unknown
            inside inside
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: