Updated 2014-03-24 22:16:03 by EMJ
This page is full of obsolete things, so look at the search page. This page and things that still link to it are possibly worth keeping for historical reasons.

This page covers the topic of using Wikit's built in search functionality; the page really did not need to mention Tcl'ers Wiki since it is part of the general functionality of a Wikit.

Searching the quick way:

Go to page "2" - the page Search - type a keyword in the edit field and press Enter.

Note that this is a one-level search only and it is a fine art to come up with the right keyword.


  • The keyword followed immediately by an asterisk (*) (no space) causes a search not only through the titles, but also through the text itself
  • If you click on the title of a page, you will instantly get a list of all the pages that refer to that page.

Searching, it seems, doesn't work for single character page names however. The page "the alphabet" has links to such pages (but it is manually updated, so some might be missing).

Searching and bookmarking is quite flexible in Wikit. To search for the word "cgi" in all page titles, you can use the URL:

To search for this word in all titles and in the full texts, use:

Or, if you prefer, you can enter the search word on the search page, at:

But there's a little more to it. That last URL is actually a form of fuzzy bookmarking. There is no web page called "search". Wikit presents its contents as if it were a directory with pages, but it is all smoke and mirrors..

First of all, note that all Wikit pages have a unique identifying number. The "About" page is at http://purl.org/tcl/wiki/1.html, for example. But although these unique IDs are effective for internal links, they are quite awkward as bookmarks, since they convey no information whatsoever about the title or contents of a page.

To offer a more useful way of bookmarking, pages which are not of the form <number>.html are treated as search instructions to locate a page. The following URL is an instruction to look for a page titled "hawaii":

Assuming there is a page titled "hawaii" (case is ignored), the above URL will lead directly to that page.

But wikis change. So do page titles, occasionally [even though there is no trival method for doing this]. Some page titles are long and may contain embedded spaces or other inconvenient characters. This all makes the above search mechanism a bit too brittle for long-lasting URLs.

The solution which has been adopted here is to refine the search process as follows (everything after the slash will be called the search term):

  1. If the search term is a reference to a page (<number>.html), then simply go to that page.
  2. If the search term matches a page title (while ignoring case), then jump to the page with that title.
  3. If the search term includes one or more upper-case letters, modify the search to be approximate (see below). If the approximate match finds exactly one page, jump to that page.
  4. Otherwise, treat the search term as a regular search, and present the search results.

Approximate matching - if the search term has upper-case letters, for example "OneTwoThree", it is turned into a match pattern (using the glob / string match syntax). In the example given, a search would be performed on page titles matching the pattern "*[Oo]ne*[Tt]wo*[Tt]hree*"

LV 2008 Apr The last rewrite of the Wiki unfortunately removed the ability to create search terms by varying the case of the words in this manner. Instead, seperate each word by a plus (+) character.

What's the point of all this? Well... this mechanism allows you to specify URLs pointing into the Tcl'ers Wiki with some quite attractive properties:

  • If the search keyword is accurate enough, it's equivalent to a real URL.
  • If the search is general enough, it'll survive minor title changes (e.g. typos).
  • The URL has a meaningful word in it, so people can remember what it was about.
  • If more pages are added to the wiki, the search will turn up more than one match.
  • This is an extremely useful feature, because the original match will be one of the search results listed, and so will new - probably related - pages.

For an example, here's a link to Don Libes' book on Expect:

And here's a search which lists all pages where the word "expect" is used:

Some searches give more hits than you would like:

And some work out nicely (right now there is a single match):

But it's not all peaches - the following won't match:

(reason: the string match is case-sensitive - maybe this can be improved).

Conclusion: the Tcl'ers Wiki has several ways to help you define bookmarks which do not break quickly when the wiki changes (which it will, constantly!)

-- JC

LV: 2000/March 24

How do I express a URL using the fuzzy matching and multiple words ?

Answer: try replacing any white space by %20

RWT: 2000/March 26

I believe that you capitalize the first letter of each word. For instance, this page is http://purl.org/tcl/wiki/SearchingAndBookmarkingURLsOnTheTcl'ersWiki

willdye Nice trick! It seems to work just fine, though apparently one must be careful to also capitalize the first word of such strings. I wish the URL matcher would try to accept titles where spaces have been replaced by dashes or underlines -- e.g. "Searching_and_bookmarking_URLs". Hmm. Maybe I should just implement that myself instead of whining about it..

Wouldn't it be great if the Wiki generated a bookmark URL at the bottom of each page? (Complete with the purl address!) Something like adding Bookmark [1] to the end of the footer at the end of the page. Then you could easily copy the link into news, email, or other web pages

LV 2001/June/19: Do the words become a phrase or are they independantly anded together? And if I stick an * after a series of words like that, is it a search for any (or all?) of these words in a page?

willdye As far as I can tell, a wiki search for "spam and eggs" will treat the search term as a unified phrase, so pages with the string "eggs and also spam" will not match. Whenever I want to search for several words which are on the same page, but not necessarily all together in a single phrase, I just use Google (with "site:wiki.tcl.tk" included with the search terms)

glennj: 2001-06-19

What if I want to search for any wiki pages that contain the words "windows" and "start", but not necessarily the term "windows start"??


To answer myself, use google:

or add this form onto a web page:
      <p>Search the Tcl'ers Wiki:
      <div align=right>
      <form method=GET action="http://www.google.ca/search">
      <input type=text size="15" name="q" value="search words site:wiki.tcl.tk"><br>
      <input type=submit>

DKF 2007-08-04: Actually, you can use some of the more cunning features of the web (and the fact that Google concatenate query pieces) to make that work even more naturally...
      <form method=GET action="http://www.google.ca/search">
      <p>Search the Tcl'ers Wiki:
      <input type=text size=15 name=q value="search words">
      <input type=hidden name=q value="site:wiki.tcl.tk">
      <input type=submit value="Search!">

glennj 2007-08-21: or
      <form method="get" action="http://www.google.ca/search">
      <input type="text" size="15" name="as_q">
      <input type="submit" value="Search!">
      <input type="hidden" name="as_sitesearch" value="wiki.tcl.tk">

sbron: 2006-01-14

You can add the Tcl'ers Wiki to the list of search engines available in Mozilla/Firefox by creating a file called something like wikitcl.src and placing it in the searchplugins directory:
 # Mozilla/TCLer's wiki plug-in by Schelte Bron

    name="TCLers wiki"
    description="The TCLers wiki"

 <input name="S" user>

    charset = "UTF-8"


Find a nice 16x16 gif image to go along with it, call it wikitcl.gif and place it in the same directory.

sbron: 2009-12-28 An even easier method is to click the link on http://www.tclcode.com/tools/search.html