Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matt Brown 62 posts 174 karma points
    Apr 26, 2016 @ 17:19
    Matt Brown
    0

    Enhancement Request - API to append original search string to links of results

    I would like to be able to search for "cat in the hat" and in the results list of all the fields that contain "cat in the hat" to have that appended to the result href so that I could filter for it on the page to highlight the found text.

    href might look like:

    http://dtnaaiaas0093:50001/about/amenities/?r=cat+in+the+hat

    I name the key "r" for return so that it doesn't trigger another search which I think it would if it were "q".

    With that value I can easily check in Javascript for instances of "cat in the hat" and highlight them with some class on the page.

  • Steve Morgan 1349 posts 4458 karma points c-trib
    Apr 27, 2016 @ 08:19
    Steve Morgan
    0

    Hi Matt,

    This should be easy to do. Edit the MacroPartials/ezSearch.cshtml file.

    Look in the @helper RenderContentResult (around line 240) and modify the line

    <h2><a href="@result.Url">@result.Name</a></h2>
    

    to something like:

    <h2><a href="@(result.Url + "?r=" + Url.Encode(model.SearchTerm))">@result.Name</a></h2>
    

    HTH

    Steve

Please Sign in or register to post replies

Write your reply to:

Draft