Question
I want to create a search form that only searches the children of the topic it is placed in and excludes all other results.
Is there any way to do this? Thanks
Environment
--
GregGardinier - 12 Sep 2007
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.
I figured it out. Here is the example for anyone that wants to know:
<form action="%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%">
Find Topics:
<input type="text" name="q" size="32" value="%URLPARAM{"q"}%" /> <input type="submit" class="twikiSubmit" value="Search" />
</form>
%SEARCH{type="regex" nonoise="on" search="%URLPARAM{"q"}%" format="" nosearch="on" topic="%SEARCH{ "META\:TOPICPARENT.*\"%TOPIC%\"" type="regex" nonoise="on" format="$topic,"}%" }%
--
GregGardinier - 12 Sep 2007
Yes. Note that it only searches the direct children, not recursively the children-of-children hierarchy, a task that I think is not possible in TWiki yet to my knowledge.
--
ColasNahaboo - 12 Sep 2007
If you want to do that you can use the Plugins/TreePlugin I have a working example provided below. The trick is not forgetting to remove the div object.
<form action="%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%">
Find A Bookmark:
<input type="text" name="q" size="32" value="%URLPARAM{"q"}%" /> <input type="submit" class="twikiSubmit" value="Search" />
</form>
%SEARCH{type="keyword" search="%URLPARAM{"q"}%" format="" topic="%TREEVIEW{excludetopic="Web*"formating="outline" nodiv="true" topic="%TOPIC%" format="$topic,"}%" }%
--
GregGardinier - 12 Sep 2007