How does work the search system ?

Author Message

Pascal France

Tuesday 02 December 2008 7:07:28 am

Hi,

In a 3.10.1 version I only use the simple search (search.tpl) and not advancedsearch.

I'm using this template:

design/plain_site/templates/content/search.tpl

witch is a customiszed copy of the template used by default (design/base/templates/content/search.tpl)

I don't understand how does work this template (or the search system) because I can delete this part of the template:

  3 {section show=$use_template_search}
  4     {set page_limit=10}
  5     {set search=fetch(content,search,
  6                       hash(text,$search_text,
  7                            section_id,$search_section_id,
  8                            subtree_array,$search_subtree_array,
  9                            sort_by,array('modified',false()),
 10                            class_id, ezini('ObjetsRecherches', 'ClassesIncluses', 'recherche.ini'),
 11                            offset,$view_parameters.offset,
 12                            limit,$page_limit))}
 13     {set search_result=$search['SearchResult']}
 14     {set search_count=$search['SearchCount']}
 15     {set stop_word_array=$search['StopWordArray']}
 16     {set search_data=$search}
 17 {/section}

...the search system is still working.

The only code nedeed in this template to get results is:

1 {section name=SearchResult loop=$search_result show=$search_result sequence=array(bglight,bgdark)}
2                {node_view_gui view=line sequence=$:sequence use_url_translation=$use_url_translation content_node=$:item}<br />
3{/section}

But in this case, where do the values of $search_result come from ?

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Gaetano Giunta

Tuesday 02 December 2008 7:20:48 am

There is an ini setting that drives the value of $use_template_search.

When false, the php code of the view executes the search, and the template only displays results.
Otherwise, it is up to the template to do everything.
This has the benefit of allowing extra parameters to be added to searches (eg. for drill-down searches, facets) handling them completely in template code.

Principal Consultant International Business
Member of the Community Project Board

Pascal France

Tuesday 02 December 2008 8:20:06 am

Thanks a lot Gaetano,

The setting is «SearchViewHandling» in site.ini and has to be set to «template»

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Emmanuel Courmont

Sunday 22 March 2009 2:40:53 pm

Hi guys,

Look at this post to get more info about the setting to change.

http://ez.no/developer/forum/developer/probleme_with_the_search#msg112135

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.