Home > Fluid Dynamics Search Engine > Help > 1106

Advanced Search: Highlighting search terms in the actual document

With the FDSE proxy tool, your visitors can view documents with the search terms highlighted. For example:

example search results

Visitors can always view search results normally by simply clicking on the hyperlinked title. However, now a new link is offered, "View with highlighted search terms". When visitors follow that link, the FDSE proxy.pl or proxy.cgi script does the following:

  1. intercepts the requests, and makes a behind-the-scenes HTTP request for the document
  2. inserts a customizable header. The default header includes a disclaimer message about how you are not necessarily responsible for the content of this page, etc.
  3. then displays the page with each search term highlighted. The default highlight is bold black text on a yellow background.

example result document


How to enable

Follow these steps to allow visitors to view documents with highlighted search terms.

  1. Install FDSE version 2.0.0.0052 or newer.

  2. Visit the "proxy.pl" script that is installed at the same level as your "search.pl" script.

    Some systems require the ".cgi" extension (or some other extension) instead of ".pl". If that's the case with you, then treat .pl as .cgi everywhere in this document unless otherwise noted.

  3. Edit the source code of "proxy.pl". Find the text $SECURITY_ENABLE = 0. Set this to $SECURITY_ENABLE = 1.

  4. When you visit proxy.pl, you should see the default output which includes a string of help text and a test form with URL and keyword inputs. You must first get the proxy script working before you proceed. If you have trouble, post to the discussion forum with a detailed description of your problem.

  5. Make a test request by entering a sample URL and search term, such as "http://www.yahoo.com/" and "news". You should see a proxy-translated version of the Yahoo! main page. If you don't, then it may be that your web server is behind a firewall or proxy server or perhaps your system doesn't allow CGI scripts to make socket requests. If any of these things are true, then the FDSE proxy utility cannot be used on your site.

  6. Once you're satisfied that proxy.pl works, you may want to edit the source and customize the disclaimer text and/or the highlighting colors.

  7. Once proxy.pl works and has been customized, edit the "line_listing.txt" template. Add something like this:

    <a href="proxy.pl?terms=%url_terms%&url=%url_url%">
    View with Highlighted Search Terms</A>

  8. Your visitors will now have the option of viewing results through the proxy viewer.


Security considerations

The following are some of the security risks associated with using the FDSE proxy tool. Please read through them carefully and do not enable the proxy tool if these risks apply to your site.

As of FDSE 2.0.0.0052, the proxy.pl/proxy.cgi ships with $SECURITY_ENABLE = 0. These risks are only present after enabling the proxy.


Known limitations

History: the proxy viewer was added in FDSE version 2.0.0.0050.


    "Advanced Search: Highlighting search terms in the actual document"
    http://www.xav.com/scripts/search/help/1106.html