Forums / Developer / search engine not working

search engine not working

Author Message

Fátima Chapri

Monday 16 February 2009 2:32:01 pm

Hi,

My ez search engine is not working and I don't know how to start investigating what went wrong because it was working perfectly some time ago.

The admin search engine is working perfectly, but the site one not.

Any ideas about how to solve the problem?

justin kazadi

Tuesday 17 February 2009 12:00:53 am

Hi,
could you please show us your code(for the search engine).without it is difficult to says what is the problem.

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

Fátima Chapri

Tuesday 17 February 2009 1:04:50 pm

Hi,
Here is my code of extension/ezwebin/design/ezwebin/templates/content/search.tpl

{let search=false()}
{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('modified',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}

<div class="content-search">

<form action={"/content/search/"|ezurl} method="get">

<div class="attribute-header">
	<h1 class="long">{"Search"|i18n("design/ezwebin/content/search")}</h1>
</div>

<p>
    <input class="halfbox" type="text" size="20" name="SearchText" id="Search" value="{$search_text|wash}" />
    <input class="button" name="SearchButton" type="submit" value="{'Search'|i18n('design/ezwebin/content/search')}" />
</p>

    {let adv_url=concat('/content/advancedsearch/',$search_text|count_chars()|gt(0)|choose('',concat('?SearchText=',$search_text|urlencode)))|ezurl}
    <label>{"For more options try the %1Advanced search%2"|i18n("design/ezwebin/content/search","The parameters are link start and end tags.",array(concat("<a href=",$adv_url,">"),"</a>"))}</label>
    {/let}

{section show=$stop_word_array}
    <p>
    {"The following words were excluded from the search:"|i18n("design/ezwebin/content/search")}:
    {section name=StopWord loop=$stop_word_array}
        {$StopWord:item.word|wash}
        {delimiter}, {/delimiter}
    {/section}
    </p>
{/section}

{switch name=Sw match=$search_count}
  {case match=0}
  <div class="warning">
  <h2>{'No results were found when searching for "%1".'|i18n("design/ezwebin/content/search",,array($search_text|wash))}</h2>
  </div>
    <p>{'Search tips'|i18n('design/ezwebin/content/search')}</p>
    <ul>
        <li>{'Check spelling of keywords.'|i18n('design/ezwebin/content/search')}</li>
        <li>{'Try changing some keywords (eg, "car" instead of "cars").'|i18n('design/ezwebin/content/search')}</li>
        <li>{'Try searching with less specific keywords.'|i18n('design/ezwebin/content/search')}</li>
        <li>{'Reduce number of keywords to get more results.'|i18n('design/ezwebin/content/search')}</li>
    </ul>
  {/case}
  {case}
  <div class="feedback">
  <h2>{'Search for "%1" returned %2 matches'|i18n("design/ezwebin/content/search",,array($search_text|wash,$search_count))}</h2>
  </div>
  {/case}
{/switch}

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

{include name=Navigator
         uri='design:navigator/google.tpl'
         page_uri='/content/search'
         page_uri_suffix=concat('?SearchText=',$search_text|urlencode,$search_timestamp|gt(0)|choose('',concat('&SearchTimestamp=',$search_timestamp)))
         item_count=$search_count
         view_parameters=$view_parameters
         item_limit=$page_limit}
</form>
</div>
{/let}

Whenever I try to make a search of any word or phrase that I'm sore it exists on my site content it keeps showing the following message:

No results were found when searching for "".

It seams that the Input Search Text is not getting the parameters correctly.

But In the administration interface everything works fine. That's why I think that the ezserchengine.php file has nothing wrong with the code.

Any sugestion?
Please Help!

justin kazadi

Tuesday 17 February 2009 11:44:09 pm

hi,
i don't talk about the search.tpl but about your search form (in your pagelayout.tpl).

i think you have an error on your form.

No results were found when searching for "".

means that the search engine don't get correctly the SearchText. so the searchtext is empty.

use this code:

<form id='search_from' action={"/content/search"|ezurl} >
		<label for="searchtext">rechercher sur le site</label>
		<input id="searchtext" name="SearchText" type="text" />
		<input id="searchbutton" type="submit" value="OK"/>
	</form>

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

Fátima Chapri

Wednesday 18 February 2009 12:13:34 am

Hi Justin,

I tried using your code. Mine was same as your's but with a small difference: mine had if statements. Even though i used your and cleaned the cache to see the modifications. Made a 1st search after that and everything was fine. But when i made a 2nd search with diferent paramenters it showed me the results of the previous search.
I tried cleaning the cache and do the search again, and voilá, everything fine again.

This manda me realise that there's nothing wrong with the code. But that the promlem is the the cache statements. I'l have to investigaue the cache statements of the page5azout.tpl to find out what's wrong

eZ debug

Timing: Jan 18 2025 15:15:31
Script start
Timing: Jan 18 2025 15:15:31
Module start 'content'
Timing: Jan 18 2025 15:15:31
Module end 'content'
Timing: Jan 18 2025 15:15:32
Script end

Main resources:

Total runtime0.9264 sec
Peak memory usage4,096.0000 KB
Database Queries200

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 589.1406180.8359
Module start 'content' 0.00730.7839 769.9766583.9688
Module end 'content' 0.79110.1352 1,353.9453341.3750
Script end 0.9263  1,695.3203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.4586210.0002
Check MTime0.00140.1547210.0001
Mysql Total
Database connection0.00070.078310.0007
Mysqli_queries0.854092.18472000.0043
Looping result0.00190.20181980.0000
Template Total0.895596.720.4478
Template load0.00270.292120.0014
Template processing0.892896.378420.4464
Template load and register function0.00010.015510.0001
states
state_id_array0.00080.089410.0008
state_identifier_array0.00090.094620.0004
Override
Cache load0.00230.2534350.0001
Sytem overhead
Fetch class attribute can translate value0.00150.161230.0005
Fetch class attribute name0.00090.099360.0002
XML
Image XML parsing0.00110.115330.0004
class_abstraction
Instantiating content class attribute0.00000.001570.0000
General
dbfile0.00280.2990270.0001
String conversion0.00000.000830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs