Search Marker - when using the EE search module this plugin highlights the search terms on the search results page
This plugin is specifically for search results from the internal EE search module.
Search hilite does highlight search terms coming from external search engines. At some point support for the EE search module was added. I couldn’t get it to work for the EE search at all because in my server configuration redirects have no HTTP_REFERER and the result page comes from a redirect. Some other issues have been reported in this thread which I have neither tested nor reproduced.
Hi Silenz
Thanks for this plugin - I’ve been looking for a something that does this for a while, and yours is the only one (that I’ve found) that works.
Can I point out a an improvement which might be made?
When you search for a phrase, each word gets broken up, and, especially when ‘a’ is in the phase (and other very common words), the highlighting gets scattered throughout the search result. Please see the screen shot for an example.
Is there a way around this?
Thanks again.
check out this post forum entry 55863.
the updated search hilite plugin DOES highlight EE internal searches now…
Love this plugin. It highlights the search term on my search results page. Then I use the search_hilite plugin to highlight the search term on the actual page. It’s a great 1-2 combo.
But there are 2 problems I’m having with search_marker. I have a lot of conditionals in my search results page depending on which weblog is being displayed. (example: a custom field “keywords” is only available on 1 of the weblogs, so when a result is displayed from that weblog, I also display the keywords)
1) When certain terms are used in the search, AND and OF for example, all my conditional EE code gets displayed on the results page.
2) If the search term is highlighted and also in one of the conditionals, I get an “Invalid EE Conditional Variable” error. So the following code breaks:
{if weblog_id=="7"}<strong>Keywords:</strong> {exp_keywords }{/if}
That makes sense to me since the span code would be wrapped around the term, but I wouldn’t know how to not apply the highlight function when used in a conditional.
If anyone wants to help me debug this to get it working, I’ll re-enable search_marker for my website so you can see what I’m talking about. But for now, I’m going to have to disable this otherwise cool plugin.
No problem.
{embed="inc/.head" body_class="search" page_name="Search Results" paginate="bottom"}
<div id="scriptlist">
<div class="crumb"><a href="http://{path=SITE_INDEX}class=crumb">Home</a> » <a href="http://{path=search}class=crumb">Search</a> » Search Results</div>
<h2>SEARCH RESULTS</h2>
Your search for <span class="bold italic">'{exp:search:keywords}'</span> found {exp:search:total_results} result{if "{exp:search:total_results}" != "1"}s{/if}
{exp:search:search_results rdf="off"}
{exp:search_marker}
<a href="http://{auto_path}">{if weblog_id=="7"}{programid} {/if}{title}</a>
<span class="archive">{if weblog_id!="7"}<strong>Section:</strong> {weblog} {if:else}<strong>Category:</strong> {categories show="not 37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62" backspace="2"}{category_name} / {/categories}{/if}{if weblog_id=="7"} <strong>Released:</strong> {entry_date format="%d %M, %Y"}{/if}
{excerpt}{if weblog_id=="7"}
<strong>Keywords:</strong> {exp_keywords }{/if}</span>
{/exp:search_marker}
{/exp:search:search_results}
{if paginate}
{page_count}</span> {paginate}
{/if}
{embed="inc/.foot"}
Updated this post to reflect my code in all it’s properly working glory, in case anyone else finds it useful.
It only happens when I use the plugin. When I remove the plugin code, the search works fine.
(I put {exp:search_marker} back in after the {exp:search:search_results} code)
When I search “The Name Of Love” I will get the errors. The EE search function strips out THE and OF, but somehow that causes all the code to appear.
If I just search “Name Love” and the plugin is active, then it works fine.
If I remove the plugin and search for “The Name Of Love” it will work fine, stripping out THE and OF, but not giving me errors.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.