Forums / Setup & design / search templates and highligt node

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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......