User Documentation

Search Results

Installation

For 2.x

You install the Search Results module with the standard Expression Engine 2.x method.

  1. Download your copy of the module.
  2. Extract the folder and files from the archived (zipped) file.
  3. Open the EE2 directory
  4. Copy the entire "key_search" folder to your third_party folder located at:
/YOUR SYSTEM DIRECTORY/expressionengine/third_party/

For 1.6.x

You install the Search Results module with the standard Expression Engine 1.6.x method.

  1. Download your copy of the module.
  2. Extract the folder and files from the archived (zipped) file.
  3. Open the EE1 directory
  4. Upload the "key_search" folder to the modules folder inside your system directory.
  5. /YOUR SYSTEM DIRECTORY/modules/
  6. Upload language/english/lang.key_search.php to:
  7. /YOUR SYSTEM DIRECTORY/language/english/
  8. Navigate to CP Home | Modules, find the Key Search module and click Install.


Using the Template Tags

Search Input

This version of the module uses the result sets produced by the default search module (simple and advanced search forms) that ships with ExpressionEngine. You can find the 1.6.x Search Module documentation here . The 2.x documentation is here.

Embedding search results in templates

Result sets can be embedded into templates with a simple tag pair:
{exp:key_search:results parameters=”values”}
	HTML and EE field tags
{/exp:key_search:results}

NOTE: In the current version you will need to include at least one parameter or the tag pair will throw an error.

Parameters

The following parameters are available to use in the primary tag pair to configure the way the records are returned to the template.
Parameter Data Type Description Default Value
switchany stringAllows you to set two or more values that will alternate between the result set rowsNULL
groupbyfield nameAllows you to set a result set field to group the row.NULL
group_repeat"yes" or "no"Directs the group field to repeat or notyes
group_sort"desc","asc"Sets the sort order of the groupby field. Desc sorts the groups in a descending alphanumeric order. Asc sorts the groups in an ascending alphanumeric order.Productsasc
limitintegerLimits the rows returned to the number set in this parameter.no limit
orderbyfield nameSorts the result set rows (within a group) by a designated fieldentry_id
sort"desc","asc","rand"Sets the sort order to be ascending or descending within a group. Desc sorts the records in a descending alphanumeric order. Asc sorts the records in an ascending alphanumeric order. Rand sorts the records in a random order.desc
excerpt_sizeintegerThe number of words generated by the excerpt tag.50
page_sizeintegerNOTE: PAGINATION IS DEFECTIVE ON EE2.1 DUE TO EE LIBRARY CHANGES. A FIX IS IN FINAL TESTING NOW. The number of records to list on a page. Result sets larger than the page_size will be paged.no page size
highlightstringInsert span tags around search terms found in the title, excerpt and full entry. Available values are “yes” and “no”. The span class = “terms”. yes
custombooleanTurns on custom field tags. This will slightly impact the performance of the results page as customer fields are collected from the channel. no

Variables

All relevant channel entry tags are available to use between the primary tag pair. All custom field tags are available to use if the "custom" parameter is set to "yes". Custom fields can be truncated to a specific number of words. Simply use a size parameter inside of the custom field tag. (for example: {my_field size="50"})

This you can also use the following variable tags:

Tag Description
groupThis variable returns the contents of the grouped field. This tag accepts the optional variable “format” as defined at: http://expressionengine.com/public_beta/docs/templates/date_variable_formatting.html
switchThis variable is replaced by alternating values specified in the switch= parameter. A good way to use this tag is to alternate class names of HTML tags to style alternating rows to be more clear in the user interface.
auto_pathThis parameter is replaced with the URL to the entry with the URL Title appended to the end. The path will automatically be determined by the Search Results URL setting for the channel/weblog in Channel/Weblog Management.
excerptAn excerpt from the returned entry truncated to the number of words specified in the "excerpt_size" parameter. The field specified for the excerpt is selected in the Channel/Weblos Management settings for the channels/weblogs This tag accepts the optional variable “type”. By using “type” you select the format to use for the excerpt. This allows the user to include all XHTML tags or return a simple string with no XHTML tags. Options are “none”(default) and “XHTML”. This tag accepts the optional variable “end”. By using “end” you determine the HTML character code for the character the follows an excerpt string. Default is … (horizontal ellipse). An empty string can be used for no character. The string can be a link to a graphic file. If the excerpt does not have to truncate the field, the ending character does not appear in the rendered page.
read_moreThis variable is replaced with a hyperlink automatically determined by the Search Results URL setting for the channel/weblog in Channel/Weblog Management. This tag accepts the optional variable “text”. You can use "text" to override the default string of "Read more". (example usage text=”see more”)

All ExpressionEngine conditional statements work within the primary tag pair.

A single variable tag is available to be used anywhere on a results page:

{exp:key_search:referring_page}

This tag returns a URI string of the page that initiated the search. This can be used in a link tag HREF parameter.

Other Features

Search term highlighting

If the parameter "highlight" = yes then search terms are surrounded with <span class="terms"> and </span> tags. You can easily style the search terms by using the "terms" class in your stylesheets.

Error Handling

Undefined properties are trapped and sent to the normal ExpressionEngine error handling library with the error message of “You are attempting to use one or more undefined properties in your Search Results tags. Please check your template.”

Example Use Case

{exp:key_search:results groupby="channel" group_sort="asc" group_repeat="no" excerpt_size="60"}
	<h4>{group}</h4>
	<div class="result">
		<a href="{auto_path}">{title}</a>
		{excerpt end=">>" type="XHTML"}
		{author}
		{read-more}
	</div>
{/exp:key_search:results}

How to get help

We want to you get the most out of this plugin so please contact us if you need help. Please send us your question at support@planet-ee.com