Home > Fluid Dynamics Search Engine > Help > 1121

How to show examples of keyword matches in the search result listings

This search engine can be made to show an example of the search keyword being used in the document text.

By default, the search results include only title, URL, and description. Consider this example of a default listing:


1. Privacy Policy
Describes how Fluid Dynamics collects, uses and safeguards the personal information you provide to us on our site.
URL: http://www.xav.com/privacy.html - 24kb - 06 Oct 2001

The "show examples" feature extends the listing by including an example of how the search keyword is used in the document text. The keyword is shown in bold:


1. Privacy Policy
Describes how Fluid Dynamics collects, uses and safeguards the personal information you provide to us on our site.
URL: http://www.xav.com/privacy.html - 24kb - 06 Oct 2001
Excerpt: of password exposure through packet sniffing or through somebody compromising...

The advantages of using the show examples feature are:

A disadvantage of this feature is that the search engine will require slightly more memory, disk space, and processor time.

How to Enable this Feature

  1. Go to "Admin Page" => "User Interface"

  2. Edit the setting "Show Examples: Enable" and set it to one (checked).

  3. You may want to edit the "Show Examples: Number to Display" variable. Leaving it at its default value of one will incur only a very light memory and processor time hit. Setting it to any value larger than one will incur a larger hit.

  4. You may want to stop stripping common words from the index files, since common words make the examples more readable. To stop stripping common words, go to "Admin Page" => "General Settings" and edit the "Ignore Words" setting. Delete all of the words listed there. Then rebuild all index files. Retaining common words will cause FDSE to use a little more memory, disk space, and processor time, but the search results excerpts will be much more readable.

The search keyword will be shown in bold using the "hl2" CSS class. You can customize that CSS class in the style.inc file to highlight it in other ways, such as with italics or different colors.

Note: if all of the META descriptions on a web site are identical or otherwise not helpful, they can be removed entirely from the search results listing by editing the "line_listing.txt" template which also appears on the "Admin Page" => "User Interface" screen. The description will be removed from the results if you delete the %description% replacement variable from that template.

See also Controlling excerpt length.


    "How to show examples of keyword matches in the search result listings"
    http://www.xav.com/scripts/search/help/1121.html