Tags:
create new tag
view all tags

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

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories:  

-- GregGardinier - 12 Sep 2007

Answer

ALERT! 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"}%" />&nbsp;<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"}%" />&nbsp;<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

Change status to:
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2007-09-12 - GregGardinier
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.