Questions answered by this recipe
- How can my site be searched using the browser's own search box?
- How can I quickly go to a page on my site by just typing a few characters from its name?
This recipe implements the OpenSearch description document, its autodiscovery from wiki pages, and the OpenSearch suggestions extension that allows for search term autocompletion/autosuggestion.
To install this recipe
- download opensearch.phpΔ to your cookbook directory
- add the following to your config file:
The following variables may be set in your config file to configure the way OpenSearch works.
The base URL to add the actions to. For example, if you have a separate search page you might want to set this to
"or whatever else is applicable.
An array of XML elements to include on the OpenSearch description document, accessible using
array( 'ShortName' => substr(
$WikiTitle, 0, 16 ), 'Description' => "Search
action=opensearchdescription. Please see the specification for details. The only required elements are the two included by default, along with the
Urlelement that is added automatically.
The autocompletion only works for page names at the moment, in order to make the script as fast as possible. As eg. Firefox doesn't support the Query URL part of the JSON autocompletion reply, the default
search action is overloaded to recognise a fully valid page name as a search term, and redirect to it.
At least for now, search results are only provided in the same HTML output as PmWiki normally produces. RSS and/or Atom feeds could be done, using customized PageList output.
- 2009-02-20Δ — first public release
- PITS:00871 Implement opensearch
- OpenSearch 1.1 (Draft 3) specification
- OpenSearch Suggestions extension
- Cookbook.FeedLinks - Add HTML-header links to enable autodiscovery of RSS/Atom feeds.
See discussion at OpenSearch-Talk?
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.