This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » Ezfind sort_by multiattributes

Ezfind sort_by multiattributes

Ezfind sort_by multiattributes

Monday 17 October 2011 2:06:12 pm - 2 replies

I use ezfind 2.0 and i want to sort result for two attributes (actualite.paper_publication_date and article.paper_publication_date).

It's possible with ezfind 2.0 ?


sort_by,  array( 'and',
                                                                    concat('actualite/paper_publication_date:[', $annee ,'-01-01T00:00:00.000Z TO ', $annee ,'-12-31T23:59:59.999Z]'),
                                                                    concat('article/paper_publication_date:[', $annee ,'-01-01T00:00:00.000Z TO ', $annee ,'-12-31T23:59:59.999Z]')


Thank you.


Monday 17 October 2011 10:29:05 pm

Hi, yes you can combine sorting in ezfind search fetch, but the syntax is a bit different.


 {set $search=fetch( ezfind,search,
                        hash( 'query', $search_text,
                              'offset', $view_parameters.offset,
                              'limit', $page_limit,
                              'sort_by', hash( 'article/publish_date', 'desc',
                                               'article/unpublish_date', 'asc' ),
                              'facet', $defaultSearchFacets,
                              'filter', $filterParameters,
                              'publish_date', $dateFilter,
                              'spell_check', array( true() ) 

The query analyzer transfers it into such an array:

 ["sort"]=>  string(52) "attr_publish_date_dt desc,attr_unpublish_date_dt asc"

But i see a kind of filter syntax in your expression, you can of course filter the result and sort by attribute. The date attribute is stored in timestamp format which is easilly sortable.

Monday 24 October 2011 8:33:16 am

Hi Artur,

In your syntax, you specify first sort by publish_date and after by unpublish_date.

You realized a sort with 2 levels and 2 attributes.

Me, i have 2 attributes but i just want one level.

You understand my problem ?

Thank a lot for you help


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from