This is an ex-addon.
- This add-on has been discontinued, joined the choir invisible and therefore is no longer available.
Compatibility: | EE2, EE3, EE4 |
---|---|
Latest release: | 2.0.0 (released 2016-01-29) |
Licensing: | Commercial License Agreement |
Form tag
This tag pair will generate the opening and closing form
tags for your search form.
When submitted, it will redirect the user to a url based on the given result_page
parameter and the posted keywords, which will be encrypted and appended to the url.
All the form requires from you is an input field with name="keywords"
.
Parameter | Description |
---|---|
form_class |
Adds a class attribute to the form tag. |
form_id |
Adds an id attribute to the form tag. |
result_page |
The template_group/template where the search results are to be shown. Defaults to search/results . |
{exp:low_googlesearch:form}
<fieldset>
<legend>Search this site</legend>
<label for="keywords">Keywords</label>
<input type="text" name="keywords" id="keywords" />
<button type="submit">Search</button>
</fieldset>
{/exp:low_googlesearch:form}
Keywords tag
To display keywords outside the results-tags.
Parameter | Description |
---|---|
keywords |
The encoded keywords to decode and display. This parameter is required. |
format |
Either raw , url or html to decode and display encoded keywords.
Set to encoded to encode given keywords for use in the URI. Defaults to html . |
<title>
{exp:low_googlesearch:keywords keywords="{segment_3}"} - Search - {site_name}
</title>
Results tag
This tag pair will generate the search results based on the data posted by your search form. It will contact your GM, GSA or GSS with the given keywords (which it will first decrypt) and return the results for you to display in your template.
Parameter | Description |
---|---|
cx |
The GSS id provided by Google. The id looks like this:
999999999999999999999:srraaaaaaaa . This parameter is required with GSS. |
decode |
Set to no if you do not want the keywords to be decoded before the search results are fetched. |
entries_switch |
Pipe separated list of values for the {switch} variable inside the {entries} variable pair. |
fail |
Set to silent if you want to suppress any errors that might occur when fetching the search results. |
host |
The host name assigned to our GM or GSA. This parameter is required GM or GSA. |
initiate |
Pipe-separated list of variable names to be initiated in the {entries} variable pair, to prevent unparsed variables. |
keywords |
The keywords to search for. These can be encrypted in a segment or hard-coded in your template. This parameter is required. |
result_page |
The template_group/template where the search results are to be shown. Defaults to search/results . |
secure |
Set to yes if you want to fetch the results using https. |
Request Parameters | All Request Parameters used by the GM, GSA or
GSS are available. In case of the first two, use the parameters client
and site to determine which collection to search through. |
Variable | Description |
---|---|
{approx_results} |
The estimated total number of results for the search. See also: Automatic Filtering of Search Results. |
{current_page} |
Current page number of search results. |
{end_result} |
Absolute number of the last search result being displayed. |
{entries} |
Variable pair; the search results found. Inside, these variables are available:
|
{if keymatch} |
Conditional; set to TRUE when a KeyMatch is found. |
{keymatch_description} |
KeyMatch description for current search. |
{keymatch_url} |
KeyMatch URL for current search. |
{keywords} |
Search keywords, HTML-safe. |
{keywords_encoded} |
Search keywords, encoded. |
{keywords_raw} |
Search keywords, unaltered. |
{keywords_url} |
Search keywords, URL-safe. |
{next_path} |
The full URL to the next page of search results. |
{pagination} |
Variable pair; for generating pagination links for search results. Inside, these variables are available:
|
{previous_path} |
The full URL to the previous page of search results. |
{search_url} |
Complete URL used to fetch the search results from your GM, GSA or GSS. |
{start_result} |
Absolute number of the first search result being displayed. |
{suggestions} |
Variable pair; the spelling suggestions found for given search. Inside, these variables are available:
|
{synonyms} |
Variable pair; the synonyms found for given search. Inside, these variables are available:
|
{time} |
Time it took for the GM, GSA or GSS to come up with the search results. |
{total_pages} |
Total number of pages with search results, based on the estimated total results ({approx_results} ) and the num parameter defined in the Request Parameters |
{total_results} |
The total number of search results being displayed. |
{total_suggestions} |
Total number of spelling suggestions found for current search. |
{total_synonyms} |
Total number of synonyms found for current search. |
PageMap Variables
Per search result, it is possible to display PageMap data. These take the following format: {type:name}
, where the type is the DataObject type, and the name is the Attribute name. For example: {thumbnail:src}
or {document:author}
.
To see which PageMap variables are available, turn on Template Debugging, and look up the list generated by Low GoogleSearch. Not all entries have the same PageMap variables, which can lead to unparsed variables. To prevent that, use the initiate=""
parameter in the Results tag.
Meta Variables
When using the getfields parameter made available by the Google search service, you can access the meta variables in the search results. For each meta field, use the {meta:fieldname}
syntax. For example, when using getfields="description"
, you can use {meta:description}
inside the entries variable pair to output a page description.
Example
{exp:low_googlesearch:results
keywords="{segment_3}"
host="googlemini.domain.com"
oe="utf8"
client="default_frontend"
site="default_collection"
initiate="thumbnail:src|thumbnail:width|thumbnail:height"
}
{if keywords}
<p>Searched for <strong>{keywords}</strong><br />
Results <strong>{start_result} – {end_result}</strong> of about <strong>{approx_results}</strong>.</p>
{/if}
{if keymatch}
<p>KeyMatch: <a href="{keymatch_url}">{keymatch_description}</a></p>
{/if}
{if total_synonyms}
<h3>Also try:</h3>
<ul>
{synonyms}
<li><a href="{path="search/results/{synonym_url}"}">{synonym_name}</a></li>
{/synonyms}
</ul>
{/if}
{entries}
{if count == 1}<ol id="searchresults">{/if}
<li{if filtered} class="level2"{/if}>
<h3><a href="{url}">{title}</a></h3>
{if excerpt}<span class="excerpt">{excerpt}</span>{/if}
<span class="meta">{display_url}</span>
{if more_url}<span class="sitesearch">[ <a href="{more_url_path}">More results from {more_url}</a> ]</span>{/if}
</li>
{if count == total_results}</ol>{/if}
{/entries}
{if total_pages > 1}
<p class="pagination">
<span class="count">Page {current_page} of {total_pages}</span>
{if previous_path}<a class="prev" href="{previous_path}">Previous page</a>{/if}
{pagination}
{if is_active}
<strong>{page_count}</strong>
{if:else}
<a href="{pagination_path}">{page_count}</a>
{/if}
{/pagination}
{if next_path}<a class="next" href="{next_path}">Next page</a>{/if}
</p>
{/if}
{/exp:low_googlesearch:results}