''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.
But:
* 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 and bookmarking is quite flexible in Wikit.
To search for the word "cgi" in all page titles, you can use the URL:
http://purl.org/tcl/wiki/cgi
To search for this word in all titles and in the full texts, use:
http://purl.org/tcl/wiki/cgi*
Or, if you prefer, you can enter the search word on the [search] page, at:
http://purl.org/tcl/wiki/search
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 ''.html'' are treated as search instructions to locate a page. The following URL is an instruction to look for a page titled "hawaii":
http://purl.org/tcl/wiki/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 (''.html''), then simply go to that page
1. If the search term matches a page title (while ignoring case), then jump to the page with that title
1. 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.
1. 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*'''"
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:
http://purl.org/tcl/wiki/Expect
And here's a search which lists all pages where the word "expect" is used:
http://purl.org/tcl/wiki/expect*
Some searches give more hits than you would like:
http://purl.org/tcl/wiki/Web
And some work out nicely (right now there is a single match):
http://purl.org/tcl/wiki/CGIWeb
But it's not all peaches - the following won't match:
http://purl.org/tcl/wiki/CgiWeb
(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'' [http://purl.org/tcl/wiki/SearchingAndBookmarkingURLsOnTheTcl'ersWiki]
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"??
2002-08-13
To answer myself, use google:
http://www.google.ca/search?q=windows+start+site%3Awiki.tcl.tk
or add this form onto a web page:
Search the Tcl'ers Wiki:
----
[Category Wikit]
-
[Category Tcler's Wiki]