Search


 * Search could also mean Wiki Search

This plugin adds search functionality to the engine. It provides search based on an index and highlights results in the book if possible. There are two basic ways the plugin can produce search results:
 * one is using the internal search functionality. For this purpose, the path to an index file must be given in . For more information on the index format, see below. The index will be loaded once in the beginning and then used to process search queries.
 * the other is using a server based search script. A PHP example one will be provided, which implements the exact same functionality as the engine internal search routine. To use this mode, change  to "server" and define the category to search in using.

= Index = The search index used by the default implementations is a simple text file where pages are separated by a \f control character (form feed, see Wikipedia for more information). Such an index can either be generated manually, or when generating it from a PDF, click "File > Save as Text..." ("Text (verfügbar)" in German). In most cases, though, it will be necessary to perform further clean up, e.g. removing special characters.

Example file
This example index was generated from the Wald PhD. Some cleanup was done regarding special characters and stop words.
 *  [[Media:Search-example-index-wald phd.7z|Download]] 

= Highlighting = Search matches can be highlighted on the book's pages if they are accordingly formatted. For this feature to work, the text displayed on the pages must be embedded in a SWF file which embeds the font information. This can be achieved by creating a SWF from a FLA using static text fields, or when converting a PDF to SWF files (using PDF2SWF) using the parameter "-f", and if necessary "-F" (also see the corresponding info on the SWFTools Wiki).

= Searching = When searching it is possible to define required and forbidden words, using the  and   characters as prefixes, respectively. For example, the query  would find all pages containing at least , optionally also  , but not pages containing.

= Plugin interactions =

Javascript
If the JavaScript plugin is loaded, it will be possible to trigger a search using the JavaScript API.

Links
If the Links Plugin is loaded, a special url "protocol" can be used to start a search on a click with the mouse.

This allows to prepare a specific search that will run if the element providing such url is clicked.

This can be an &lt;img&gt; or &lt;area&gt; tag; or whatever element is supporting the url attribute. If e.g. an &lt;area&gt; is defined and an url attribute set with "search:" as protocol, the words added as value will be used as mandatory keys for an immediately triggered search.

Example

On a page a l'''ist of topics is provided in kind of a table. '''

Behind each cell an area element is placed set like this one, which will list all hits for pages, where all 3 word "2014", "special" and "offer" are located.

With a click inside the area a search will be started that uses the search text: "+2014 +special +offer"

This allows to offer "intelligent links" for topics that are spread across the MZ3 Title, and where the position i.e. page namer might change, and that can occur more than once.

Another use case could be an art catalog, whre the key words for a search are artists or technology.

= Settings =

= Custom server-side search = When implementing a custom server-side search script, have a look at the default implementation for reference. The input is given via the  setting (see that settings documentation for what the variables represent). The output must be XML, and look as described in the following.

If an error occurs while searching (not if there are just no matches):

Otherwise:

These are the very basics. Your script may return more meta information for a match by adding more attributes to the  tag. Per default, there is one more attribute expected,. A list of these additional attributes may be given in the  setting. All attributes with the names listed there will be made available to be used in the GUI in the  localization string. I.e. for every attribute name listed in, an additional variable is tried to be put into the   string (numbering starts at   and then goes on  ).

So for example if  and   were set to the following in the   localization files: it would evaluate to the following for the example result:

= Example =