We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Search Marker

Development and Programming

silenz's avatar
silenz
1,648 posts
18 years ago
silenz's avatar silenz

Search Marker - when using the EE search module this plugin highlights the search terms on the search results page

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
18 years ago
Ingmar Greil's avatar Ingmar Greil

Does not {exp:search_hilite} do that, too? If so, how is your plugin different?

       
silenz's avatar
silenz
1,648 posts
18 years ago
silenz's avatar silenz

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.

       
Adam George's avatar
Adam George
283 posts
about 18 years ago
Adam George's avatar Adam George

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.

       
pirco's avatar
pirco
218 posts
about 18 years ago
pirco's avatar pirco

check out this post forum entry 55863.

the updated search hilite plugin DOES highlight EE internal searches now…

       
Marc Miller's avatar
Marc Miller
84 posts
16 years ago
Marc Miller's avatar Marc Miller

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.

       
silenz's avatar
silenz
1,648 posts
16 years ago
silenz's avatar silenz

It would probably be helpful to see some more of the code on the search results page in order to get get a better view of the context.

       
Marc Miller's avatar
Marc Miller
84 posts
16 years ago
Marc Miller's avatar Marc Miller

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.

       
silenz's avatar
silenz
1,648 posts
16 years ago
silenz's avatar silenz

So, if you use the stuff above and the search terms include AND or OR, EE conditional code gets displayed?

If so, does this only happen when using the plugin or always?

       
Marc Miller's avatar
Marc Miller
84 posts
16 years ago
Marc Miller's avatar Marc Miller

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.

       
silenz's avatar
silenz
1,648 posts
16 years ago
silenz's avatar silenz

I’ll see if I can replicate the issue, but tomorrow.

       
silenz's avatar
silenz
1,648 posts
16 years ago
silenz's avatar silenz

Sorry for letting you wait this long. I have now looked into the issue and was able to fix it. If you download the latest version your conditionals should be safe, even if EE strips out search terms.

       
Marc Miller's avatar
Marc Miller
84 posts
16 years ago
Marc Miller's avatar Marc Miller

Yep - works great now! Thanks!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.