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.