Question
There must be a way to create a box on a page were a user can enter a keyword on which to search, click an associated search button, and search a predefined set of topic pages. What I need to do is to allow users to search through a set of meeting notes. These notes are parented from a topic page. I'd like to allow users to search through the set of child notes from the parent topic for keywords for which the user is interested. Is this easy to do?
My site's TWiki version is actually TWiki-4.2.3, Wed, 06 Aug 2008, build 17396 but I didn't see that option in the pulldown below.
Environment
--
TWikiGuest - 18 Oct 2008
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
There are a couple of ways to accomplish what you want. If the topics are named hierarchically, you can use the topic= and excludetopic= operands to include and/or exclude topics from the search. So fi the parent is MyCommittee and the children are MyCommitteeMinutesXXXXX then you could
%SEARCH{"search term" topic="MyCommitteeMinutes*" }% or something to that effect. If there are topics that are included that you don't want you exclude them with the excludetopic=
If you can't do this with names, then you have to write a regular expression that matches the
%META:TOPICPARENT{name="ParentName"}% metadata string that is in the topic data, long with the desired search keywords.
--
GeorgeClark - 19 Oct 2008
Or, if your minutes have a specif string in them, such as
theMeetingMinutesCategory, you can search for the user-specified string XXX + theMeetingMinutesCategory.
If it is a Form Foo, search for
%SEARCH{"%META:FORM{name=\"Foo\" XXX
Here is a live example I use on my internal blog to provide a search in the blog entries, and have the search string displayed in a ready-to-reuse search box at the top. (This topic is named WebcoreBlogSearch the form is WebcoreBlogForm, and WebcoreBlogSettings define the blog properties such as the title)
<h1> Searching %INCLUDE{"WebcoreBlogSettings" pattern=".*?[*] Set BLOGTITLE = *([^\n\r]*).*"}% </h1>
<div class="WChmtstatic" style="margin: 10px; padding: 0px;width: auto">
<h2><form style='display:inline; white-space:nowrap; padding:5px;margin:10px;' action='%SCRIPTURL%/view/%WEB%/WebcoreBlogSearch' method="get" name=main><input type=submit name=Do value="Search"> blog: <input type=text name=search size=64 value="%BLOGSEARCHSTRING%"></form></h2>
</div>
%SEARCH{"%META:FORM{name=\"WebcoreBlogForm\" %BLOGSEARCHSTRING%" order="formfield(Date)" nosearch="on" reverse="on" type="keyword" scope="text" header="" format="<h2>[[$topic][$pattern(.*?---[+][ \t]*([^\n\r<]*).*)]]</h2> <p><b class=WCauthor>From: $formfield(Author)</b><p> $pattern(.*?---[+]+[^\n]*[ \n\r\t]*_*([^\n\r<_]{0,256}).*) [ [[$topic][more...]] ] <p><i class=WCdate>Date: $formfield(Date) - Type: $formfield(WebcoreBlogType) - Keywords: $formfield(WebcoreBlogKeywords) - [[$topic][Entire blog entry]] - $count(.*?(---[+][+][+][+]) .*) [[$topic#Comments_most_recent_last_small][Comments]]</i>"}%
<!--
* Set BLOGNAME = WebcoreBlog
* Set BLOGSEARCHSTRING = %<nop>URLPARAM{"search"}%
-->
--
ColasNahaboo - 19 Oct 2008