search templates and highligt node

Author Message

Helle Andersen

Wednesday 01 September 2010 4:50:27 am

Problem: In the search result we have a problem with objects/pages that only contains the search word in the headline and not in the text.

Our standard search templates looks something like this:

 <strong><a href="{$node.global_url_alias}">{attribute_view_gui attribute=$node.object.data_map.navn}</a></strong>

       <div class="attribute-short">
            {$node.highlight}
        </div>

If the search word does not appear in the text the search result only presents the headline/searchword.

If we add the following

 {$node.object.data_map.tekstfelt.content.output.output_text|washhtml|trim|shorten(200,"...")}

we get the first couple of lines. But often that means that several lines are repeated.

What we want to do is a kind of "if": If the search word appears in the text use the node hightligt - else print out the first couple of lines.

But we cannot find a variable to get the search word to include in our "if".

Something like:

 {if $node.object.data_map.tekstfelt.content.output.output_text|contains(XXXXXXXXsearchword)}

Any solutions?

//Helle

Jérôme Vieilledent

Wednesday 01 September 2010 11:30:35 pm

Hello

Do you use eZ Find ? If not, you may switch to it as its highlight feature is much more efficient ;-)

Helle Andersen

Thursday 02 September 2010 5:37:08 am

Yes we use eZ Find......

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

eZ debug

Timing: Jan 30 2025 19:32:15
Script start
Timing: Jan 30 2025 19:32:15
Module start 'layout'
Timing: Jan 30 2025 19:32:15
Module start 'content'
Timing: Jan 30 2025 19:32:16
Module end 'content'
Timing: Jan 30 2025 19:32:16
Script end

Main resources:

Total runtime1.0515 sec
Peak memory usage8,192.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 588.2344151.2109
Module start 'layout' 0.00500.0031 739.4453220.6875
Module start 'content' 0.00811.0423 960.13284,417.5859
Module end 'content' 1.05040.0010 5,377.71887.8438
Script end 1.0515  5,385.5625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3202160.0002
Check MTime0.00120.1187160.0001
Mysql Total
Database connection0.00080.071410.0008
Mysqli_queries0.958591.1541570.0168
Looping result0.00060.0572550.0000
Template Total1.000495.120.5002
Template load0.00210.201420.0011
Template processing0.998394.936020.4991
Template load and register function0.00210.199310.0021
states
state_id_array0.00080.080310.0008
state_identifier_array0.00120.109620.0006
Override
Cache load0.00180.1693220.0001
Sytem overhead
Fetch class attribute can translate value0.00220.213820.0011
Fetch class attribute name0.00230.220740.0006
XML
Image XML parsing0.00330.316320.0017
class_abstraction
Instantiating content class attribute0.00000.001340.0000
General
dbfile0.00570.5391170.0003
String conversion0.00000.000540.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs