eZ Community » Forums » Install & configuration » I can't change the simple search...
expandshrink

I can't change the simple search order of results. Please help me.

I can't change the simple search order of results. Please help me.

Tuesday 07 February 2012 7:42:43 pm - 2 replies

It seems to be a rather common issue, but i can't manage to solve it.

I know it's all about changing this code at search.tpl:

{section show=$use_template_search}    {set page_limit=10}    {set search=fetch(content,search,                      hash(text,$search_text,                           section_id,$search_section_id,                           subtree_array,$search_subtree_array,                           sort_by,array('published',false()),                           offset,$view_parameters.offset,                           limit,$page_limit))}    {set search_result=$search['SearchResult']}    {set search_count=$search['SearchCount']}    {set stop_word_array=$search['StopWordArray']}    {set search_data=$search}{/section}

 

i have tried changing the sort_by line to these things without success 

sort_by,array(array('published',false())|reverse)

sort_by,array('published',true())

and well it doesn't seem to change anything. Please help me. I hope it is as silly as possible.

I know the current reccomendation is to use EzFind but because of server limitations i can't really use it right now.

Modified on Tuesday 07 February 2012 7:44:08 pm by Francisco Castillo

Tuesday 07 February 2012 11:32:16 pm

Hi

sort_by, array( 'published', false() )
or 
sort_by, array( 'published', true() )

should do the job (this function works the same as the content/list fetch function). What your debug output says ?

Arnaud

Tuesday 14 February 2012 5:25:32 pm

Ohh ezpublish, how you keep your Ez in the name is beyond my understanding.. Anyway. The solution to the problem is simple.

You have to change search.tpl on the ezwebin/content folder but that's not all.

On your site configuation, site.ini, you also have to change this setting which is set as deafult by... default to: 

SearchViewHandling=template

expandshrink

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

36 542 Users on board!

Forums menu