Multisearch Add-On
This addon allows a single search dialog to redirect to multiple search engines. We used this for the "search" dialog in our %WEBTOPICLIST% variable, instead of the "go" dialog you see at top of twiki.org.
In this example taken from our site, a single search dialog allows you to search both the current web, as well as a mailing list, by just selecting a radio button. Other webs in our site offer different sets of searches.
The form submission goes to
multisearch/?type=something&query=inputfield
, which then redirects the query to a search engine based on the contents of TWiki.MultiSearch, which contains the master list of available search engines and their query parameters.
Syntax Rules
Here's the relevant contents of our %WEBTOPICLIST% variable:
<FORM ACTION="%SCRIPTURLPATH%/multisearch%SCRIPTSUFFIX%" METHOD="post">
<INPUT TYPE="radio" NAME="type" VALUE="%WEB%" CHECKED>UDN Technical
<INPUT TYPE="radio" NAME="type" VALUE="UnProg">UnProg<BR>
<INPUT TYPE="text" NAME="query" SIZE="15">
<INPUT TYPE="submit" VALUE="Search">
</FORM>
Of course, you can use the same general form anywhere on any page. The "type" field should be a radio button or single-select dropdown list, because there can only be one "type" of search to perform. The "query" field is your input text box, where the actual search text is input.
TWiki.MultiSearch
TWiki.MultiSearch is the topic where the settings for the multisearch addon are stored. The format is as follows:
3 spaces * Type
6 spaces * Action:
<search url>
6 spaces * Query field:
<fieldname>
6 spaces * Hidden field:
<fieldname=fieldvalue> (optional)
"Type" is the name of the search or engine; this is what the "value" field of your radio or listbox should be.
"Action" is the full URL of the search engine.
"Query field" is the CGI variable to pass to the engine with the input text box contents.
"Hidden field" can be present multiple times if necessary, to provide any additional data that the search CGI needs to operate.
Examples:
* Google
* Action: http://www.google.com/search
* Query field: q
* Hidden field: hl=en
* Yahoo
* Action: http://search.yahoo.com/bin/search
* Query field: p
* Main
* Action: %SCRIPTURL%/search%SCRIPTSUFFIX%/Main/
* Hidden field: scope=text
* Query field: search
There are no other settings or preferences.
Add-On Example
This is a
live TWiki site. Please be considerate.
http://wearforge.perilith.com/bin/view/TWiki/MultiSearch is the multisearch page with the above three searches configured, and a URL like:
http://wearforge.perilith.com/bin/multisearch?type=Google&query=TWiki will redirect you and search Google for "TWiki".
Add-On Installation Instructions
- Copy
multisearch
to your bin
directory, and add a file extension if necessary.
- Create a new
MultiSearch
topic in the TWiki06x01 web and add your search engines to it.
Add-On Info
- Set SHORTDESCRIPTION = Add a single search dialog that redirects to multiple search engines