Search facility for the NatSkin.
NatSearch unifies the Seach and the Jump box known from the standard TWiki. You can
use one input field to either jump to a topic or start a content query.
NatSearch is heavily inspired by the PhotonSearch of the TWiki:Plugins/PhotonSkin.
Usage
This basically works in three modes:
GO: look up the named topic and jump to it immediately if found
topic search: search a topic whose name matches the search string
content search: search a topic whose content matches the search string
NatSearch proceeds along the following lines:
the search string starts with an uppercase letter:
try a GO: the topic is looked up the following way:
look it up in "web" if the search string is of the form "web.topic"
or look it up in the current web
or look it up in all public webs; in case there are topics of the same name in different webs the first topic found is used, webs being sorted alphabetically
fallback to a topic search when a direct jump in 1.1 is not possible
fallback to content search when the topic search in 1.2 fails
the string starts with a /: normal content search
the string does not start with an upper case letter or /
try a topic search
fallback to content search
If only one topic was found in 2. or 3. then NatSearch jumps to that topic directly.
Options
The search string may be prepended with a set of options that are separated from the
rest of the search string with a colon(:). Known options are:
A search string may consist of a list of terms that are retrieved. If a term shall contain
spaces it can be surrounded by double quotes. Each term may be preceded with a minus (-) to
exclude this term from the hit set.
if the current web is the User go to the TWikiUsers
if the current web is the TWiki go to the TWikiUsersGuide
g:twikiusers
list all topics in all webs whose name match "twikiusers"
/TWikiUsers
list all topics that contain the word "TWikiUsers"
gu:copyright
list all topics that contain the word "copyright" in lowercase
g:copyright -webpref
list all topics that contain the word "copyright" but not "webpref"
g:"Good morning" -natskin
list all topics that contain the term "Good morning" but not "natskin"
Customization
NatSearch can be restricted to certain webs and topics by setting WebPreferences.
Besides the NOSEARCHALL feature of every web that excludes a web from search the following variables
restrict the hit set:
a regular expression that must match webs to be considered
NATSEARCHEXCLUDEWEB
a regular expression that must not match a web
NATSEARCHINCLUDETOPIC
a regular expression that must match a topic in the hit set
NATSEARCHEXCLUDETOPIC
a regular expression that excludes a topic from the hit set
Furthermore, the WebPreferences variable NATSEARCHTEMPLATE can be set to a template topic that
is used instead of the skin's search template. This can be used in TWikiApplications to
define a customized look of search results.
-- MichaelDaum? - 25 Aug 2006