Skip to the content
Documentation

Sort Clauses Reference: comparison of v.2 vs v.3

No ratings yet

Versions Compared

Old Version 2

changes.mady.by.user Sarah Haïm-Lubczanski

Saved on Nov 17, 2016

compared with

New Version Current

changes.mady.by.user Dominika Kurek

Saved on Nov 17, 2016

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Comment: typos and cleanup

Sort Clauses are the sorting options for Content and Location Search in eZ Platform. For generic use of API Search see Search Criteria and Sort Clauses.

A Sort Clause consists of two parts just like Criterion and FacetBuilder:

  • The API Value: SortClause
  • Specific handler per search engine: SortClausesHandler

The SortClause represents the value you use in the API, while SortClauseHandler deals with the business logic in the background, translating the value to something the Search engine can understand.

Info
Implementation and availability of a handler sometimes depends on search engine capabilities and limitations.

Common concepts for all Sort Clauses 

For how to use each and every Sort Clause, see list below as it depends on the Sort Clause Value constructor, but in general you should be aware of the following common concept:

  • sortDirection: The direction to perform the sort, either Query::SORT_ASC(default) or Query:: SORT_DESC

 

EZP >= 1

Status
   
colour Yellow
title v1.6.0

 

You can use the method SearchService::getSortClauseFromLocation( Location $location ) returning to return an array of Sort Clauses that you can use on LocationQuery->sortClauses.

List of Sort Clauses 

The list below reflects Sort Clauses available in the eZ\Publish\API\Repository\Values\Content\Query\SortClause namespace (it is also possible to make a custom Sort Clause):

Info
Arguments starting with "?" are optional.

Only for LocationSearch

Sort Clause Constructor arguments description
Location\Depth  ?sortDirection
Location\Id  ?sortDirection
Location\IsMainLocation  ?sortDirection
Location\Depth  ?sortDirection
Location\Priority  ?sortDirection
Location\Visibility  ?sortDirection

 

Common

Sort Clause Constructor arguments description
ContentId ?sortDirection
ContentName ?sortDirection
DateModified ?sortDirection
DatePublished ?sortDirection
Field typeIdentifier as string, fieldIdentifier as string, ?sortDirection, ?languageCode as string
MapLocationDistance  typeIdentifier as string , fieldIdentifier as string , latitude as float ,   longitude as float, ? sortDirection, ?languageCode as string
SectionIdentifier  ?sortDirection
SectionName  ?sortDirection

In this topic:

Table of Contents
maxLevel 3

Comments

Add a comment

Comments are read by a moderator before they appear.