All that is required to add TemaSearch to an existing search form, is a few changes to the form's HTML code. The changes are straightforward, though they require a basic understanding of HTML, in particular HTML forms.
Before you begin, you will need
TemaSearch has a few technical requirements that your search engine must meet:
If, instead, your current form uses POST, you may still be able to use TemaSearch, as search engines that use POST often support GET as well. To see if your search engine supports GET, change the form's method to GET, and try it out. If it works as normal, you can continue to add TemaSearch to your site. If it does not work, contact us and we can discuss the alternative solutions available.
The code below shows an example search form
<FORM method=GET action="/search">
<INPUT type="text" name="q" size="30" value="">
<INPUT type="submit" name="submit" VALUE="Søk">
</FORM>
To activate TemaSearch, you add a small number of hidden input fields (or, parameters, for short) to the form. Each parameter has a name and a value, and it written as a new INPUT element. For example, the code below adds a parameter "pq" with the value "boolean".
<INPUT type="hidden" name="pq" value="boolean">
You will need to add at least these parameters shown in the table below. (You can click on the parameter name to jump to the section providing details about that parameter.)
puser | your TemaSearch username. |
pu | the search engine URL - this is usually the same as the original action attribute, fully qualified if necessary. |
pq | the name of the field that contains the search expression. TemaSearch modifies the field to include new search words. |
px | lists all the fields that were added for TemaSearch so that they are not forwarded to the target search engine. |
pqsntx | describes how queries are written for your search engine. |
puser | jsmith |
pu | http://www.myhost.com/search |
px | px pu puser pq pqsntx |
pqsntx | standard |
pq | q |
Writing these parameters as hidden input elements, the example form looks like this (new or changed parts shown in bold.)
<FORM method=GET action="search">
<INPUT type="hidden" name="puser" value="jsmith">
<INPUT type="hidden" name="pu" value="http://www.myhost.com/search">
<INPUT type="hidden" name="px" value="pu px pq pqsntx puser">
<INPUT type="hidden" name="pq" value="q">
<INPUT type="hidden" name="pqsntx" value="standard">
<INPUT type="text" name="q" size="30" value="">
<INPUT type="submit" name="submit" VALUE="Søk">
</FORM>
Note:
Now that the parameters have been added, the final step is to change the action attribute to the TemaSearch URL you were given with your account. For example, if the TemaSearch URL you are given is http://www.tema-search.no/form then the form tag is changed from
<FORM method=GET action="search">
<FORM method=GET action="http://www.tema-search.no/form">
And that's it! Once you have saved the page to your site, TemaSearch will be enabled on the search field. If you have other search fields on your site, you can add temasearch to each of them by repeating these steps for the other fields. (If these fields use a different target URL, they must be registered with your account. See the section on security for details.
TemaSearch offers a number of configuration options that you can use to control exactly what types of alternative words are generated
povs | includes/excludes bokmål/nynorsk translations |
psynn | includes/excludes near synonyms |
pifl | includes/excludes equivalent inflections |
penab | turns on or off TemaSearch. |
A site administrator can control the behavoiur of TemaSearch by providing fixed values for TemaSearch parameters. Each parameter is configured by adding a hidden field to the form, in the same way the standard parameters were previously added.
For example, to only include translations, (i.e. exclude synonyms and inflections), psynn and pifl parameters are added to the form:
<INPUT type="hidden" name="psynn" value="0">
<INPUT type="hidden" name="pinf" value="0">
It is possible to give website users control over the types of results produced, so that they can adjust TemaSearch to their own needs. This is achieved by using FORM input elements, such as checkboxes, list boxes etc. to provide parameter values.
For example, to allow the user to enable or disable use of translations, you add
<INPUT type="checkbox" name="povs" value="1" CHECKED>
This section provides a reference for all form parameters used by TemaSearch.
Mandatory parameters are parameters that do not have a defualt value. Such parameters must be defined, or the request will fail with an error message indicating the missing parameter.
Summary | Alters options to comply with licenced features. | ||||
Details | If an option is selected for a feature that is not licenced, normally an error is produced.
(The result of the error depends upon the pnoerr parameter, but at the very least, the
no alternatives will be added to the query.
Setting this parameter allows the search to continue using those features that are licenced, and
ignoring the request for unlicenced features.
In a production environment, you would typically set this value to true so that attempted use of unliceced features does not stop temasearch from being used for those features that are licenced. In development, setting this value to false can help uncover that some features are not working because they are unlicenced. |
||||
Values |
|
||||
Default | true |
Summary | Adds the baseform of an inflected form. | ||||
Details |
When the query includes an inflected word, the non-inflected for
of that word is added to the query.
If steming is active, this parameter has no effect.
|
||||
Values |
|
||||
Default | 0 |
Summary | Indicates the character set expected by the search engine. | ||||
Details |
This is usually the same as the character set defined by the META tag. For example
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> This defines the character set to be "utf-8", so the pcharset should be set to "UTF-8". |
||||
Values |
|
||||
Default | ISO-8859-1 |
Summary | Enabled or disables TemaSearch. | ||||
Values |
|
||||
Default | 1 |
Summary | Includes alternative inflections. | ||||
Values |
|
||||
Default | 1 |
Summary | Provides a hint as to the language the user is using to enter the search query. | ||||||
Details |
When the search query could be both bokmål and nynorsk, the language TemaSearch assumes it to be is given by this parameter. Note that if the language of the input query is not ambiguous, then this parameter has no effect. This parameter is useful if the user base is strongly biased to one langage or the other. |
||||||
Values |
|
||||||
Default | (Empty string) |
Summary | Selects the language for new words added to the query. | ||||||
Details |
This parameter is usually set if the documents being searched
are all written in the same language. Setting this parameter to that
language ensures that the rewritten query only contains words in that language.
If the documents being searched comprise a mix
of languages, this parameter should not be set, so all relevant languages are
included.
While similar, this is not the same as disabling translation. For example, assume
the output language is set to bokmål. A nynorsk user will still require translation
(to bokmål) while a bokmål user will not. So, translation is used
if the text the user types needs translating to the output language.
|
||||||
Values |
|
||||||
Default | (Empty string) |
Summary | Adds all inflections of a non-inflected word. | ||||
Details |
If the query includes a non-inflected word, then inflections of that word
are added to the query.
Inflected forms are output
even if stemming is active (pstem=1), though you typically
will not enable this parameter if stemming is active.
|
||||
Values |
|
||||
Default | 0 |
Summary | Limits the total number of words that are included to the query. | ||||
Details | This is useful for keeping the overall number of words to a reasonable level, especially when the search engine accepts upto a specific maximum number of words. Often, if the number of words goes over this limit, the additional words are ignored, which may cause important words in the query to be dropped. When TemaSearch can provide more words than there is room for, it discards the least relevant words to ensure that all the original words and the 'best' alternatives are included in the query, without going over the total-word limit. | ||||
Values |
|
||||
Default | -1 |
Summary | Limits the number of words that TemaSearch will add to each word in the query. | ||||
Details | If many options are selected, such as both translations and synonyms, some words may have a large number of possible alternatives. In some cases, a large number of alternatives can make the search less precise. Setting this value to a lower number can help maintain a high search precision. When there are more alternatives for a given word than are allowed by this parameter, the least relevant words are discarded until the number of alternative words is within this limit. | ||||
Values |
|
||||
Default | 4 |
Summary | Controls error reporting. | ||||
Details | This parameter is intended as a development aid. When setting up TemaSearch or making changes to your TemaSearch configuration, it is a good idea to enable error reporting by either removing this parameter or setting it to "0". If there are problems with any of the parameters, these problems are shown instead of the search results so that you can fix the problem. Eventually, when you have tested that TemaSearch functions as you want, you can disable error reporting. This will ensure that your users are not disrupted should errors occur when using TemaSearch. | ||||
Values |
|
||||
Default | 0 |
Summary | Includes translations (nynorsk or bokmål). | ||||
Values |
|
||||
Default | 1 |
Summary | The name of the parameter in the original form that holds the search query. |
Details | This usually corresponds to an input field of type "text". |
Summary | Indicates how the search engine expects the query to be written. | ||||||||||||||
Details |
This is used by TemaSearch to ensure new words can be added in a way that is compatible with the search engine. Choose a syntax that most closely matches the features of your search engine. The most important features are how the search engine expects mandatory and alternative words to be written. If a syntax includes features that are not available with your search engine, that is not a problem. The features indicate that TemaSearch would understand the feature should a user use it with a query. TemaSearch only changes the query using the boolean OR operator, in the form is written for your search engine. All syntaxes allow the use of the word prefixes + and - to specifically include or exclude words. Temasearch does not provide alternatives for these words. |
||||||||||||||
Values |
|
Summary | Controls stemming. | ||||
Details | An inflected word (such as a plural noun, or past-tense verb) produces alternative words that are similarly inflected. Some search engines automatically search for inflections of a word, and so there is little need to include alternative words as inflections, as the non-inflected form is sufficient. Use of stemming with search engines that do not search for inflections, that is, engines that perform an exact match, can help reduce the number of search terms for a more focused result. | ||||
Values |
|
||||
Default | 0 |
Summary | Includes general synonyms. General synonyms are words that are close but not always identical in meaning for all senses of the original word. This is typically used to expand the search into related areas. | ||||
Values |
|
||||
Default | 0 |
Summary | Includes near synonyms. Near synonyms are words that are identical, or almost identical in meaning to the original word. These mostly include spelling variations for a given word. | ||||
Values |
|
||||
Default | 1 |
Summary | The fully qualified URL of the search results page. |
Details | This is usually the same as the action attribute, though this parameter must be fully-qualified, so protocol and server name will need to be included in the parameter if not present in the action. |
Summary | The name of the TemaSearch account to use to gain access to TemaSearch services. |
Summary | Lists all TemaSearch parameters added to the form. |
Details |
The FORM element contains parameters for your search engine and parameters for TemaSearch. In orderthat TemaSearch can locate information in need, all TemaSearch parameter must be listed in the px parameter, separated by a space. For example, if the parameters "pq" and "puser" were added, then the "px" parameter should be defined as "px pq puser" (note that the list includes the px parameter itself.) If any of the temasearch parameters have to be renamed to avoid clashes with existing parameters, the renamed parameter should appear in the list. (See resolving parameter conflicts for details. |
The TemaSearch parameter names have been chosen to be fairly unusual so not to clash with existing parameter names in your form. But if a TemaSearch parameter does have the same name as a parameter already defined by your form, you can rename the TemaSearch parameter to avoid having two parameters with the same name. Renaming is done by adding an underscore '_' at the front of the name.
For example, if the parameter "puser" was already used by your form, then the TemaSearch parameter should be renamed to "_puser".
The px parameter lists all the TemaSearch parameters added to the form, and includes each parameter using the name as it appears the form. For example, after renaming puser, the px parameter is defined like this
<INPUT type="hidden" name="_puser" value="jsmith">
<INPUT type="hidden" name="px" value="pu px pq pqsntx _puser">
Q. |
|
A. |
|
Q. |
|
A. |
|
Q. |
|
A. |
|
Q. |
|
A. |
|