96.1. Declaring search engines
Prev | 96. webSearch | Next

### 96.1. Declaring search engines

Search engines must be declared in system property WebSearch.searchers.

When this system property is missing, this is equivalent to having the following `property` configuration element in your `customize.xxe` file:

    <property name="WebSearch.searchers"><![CDATA[
    Google
    http://www.google.com/search?q=${searched}&hl=${locale2}&lr=lang_${lang2}

    Google (phrase)
    http://www.google.com/search?as_epq=${searched}&hl=${locale2}&lr=lang_${lang2}

    Wikipedia
    http://${lang2}.wikipedia.org/w/index.php?title=Special%3ASearch&¬
    search=${searched}&fulltext=Search

    Wiktionary
    http://${lang2}.wiktionary.org/wiki/${searched}
    ]]></property>

System property WebSearch.searchers must contain `search_engine_name`/`search_engine_URL` pairs separated by newline characters. Open lines are ignored.

The following variables are substituted in `search_engine_URL`:

Variable | Description
--- | ---
`${searched}` | Searched text.
`${locale}` | The language of the user interface (GUI) of XXE.
`${locale2}` | Same as `${locale}`, but just the first two ISO 639-1 letter codes. Example: if `${locale}` is `fr-CA`, then `${locale2}` is `fr`.

`${lang}`

The language of searched text. This language is automatically determined as follows:

- This language is the value of attribute `languageAttribute` of the `spellCheckOptions` configuration element in <ttl>XMLmind XML Editor - Configuration and Deployment</ttl>.

  When `languageAttribute` is not specified, the attribute lookup uses `xml:lang`.

- When the searched text is the selected text, the lookup starts at the element containing the caret.

  When the searched text is specified in the parameter of the command, the lookup starts (and ends) at the root element of the document.

- If the attribute lookup didn't give any result, the language used by default is the value of attribute `defaultLanguage` of the `spellCheckOptions` configuration element in <ttl>XMLmind XML Editor - Configuration and Deployment</ttl>.

  When `defaultLanguage` is not specified, the default language is `en` (English).

`${lang2}` | Same as `${lang}`, but just the first two ISO 639-1 letter codes.

The value of a variable is automatically escaped if needed too. For example, "`vin rosé`" becomes "`vin%20ros%C3%A9`".

Prev | Up | Next
96. webSearch | Home | 97. wrap