Tags:
create new tag
view all tags

Question

Hello,

I've defined a nested search which allows me to find two topic levels, starting from a parent one.

From this I've two problems, and I don't know if what I intend is possible.

First, I'd like to put the search request in a variable. That does not cause any issues. But I'd like the first element of the search to be a parameter, a variable.

To explain it simply, I'd like to define the search string in a variable in the WebPreferences for example, and then be able to use this search but providing a custom root e.g. changing the variable containing the root topic name. The problem is that the search string is analysed during the first affectation, and so is the root topic variable. So I can't change it. I tryed to put a in the search string, but then, it is never analysed.

So Is there a way to do that ?

Here is my search string and my root topic variable :
(I added escape char for the surrounding '%' before posting it !)
(By the way, this search works fine if used without wanting to change the WEBROOTTOPIC)

#Set WEBROOTTOPIC = RootTopic

#Set WEBTREEVIEW = \%SEARCH{ "\%META:TOPICPARENT\{name="\%WEBROOTTOPIC\%"\}\%" type="regex" format="$n * $topic $n$percntSEARCH{\"\$percntMETA:TOPICPARENT\{name=\$quot$topic\$quot\}\$percnt\" type=\"regex\" format=\" * $dollartopic\" nosearch=\"on\" nototal=\"on\" }$nop%" nosearch="on" nototal="on" }\%

Many thanks

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: FC6
Web server:  
Perl version: 5.8.5
Client OS: Win XP
Web Browser: firefox
Categories: Search

-- TWikiGuest - 17 Apr 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.

simplified example in action?

   * Set WEBROOTTOPIC = WebHome

   * Set WEBTREEVIEWNONVARIABLE = %SEARCH{ "META:TOPICPARENT{name=\"WebHome\"}%" type="regex" topic="HowToPutAParametrizedSearchInVar"}%

   * Set WEBTREEVIEW = %SEARCH{ "META:TOPICPARENT{name=\"%WEBROOTTOPIC%\"}%" type="regex" topic="HowToPutAParametrizedSearchInVar"}%

WEBTREEVIEWNONVARIABLE

%WEBTREEVIEWNONVARIABLE%

WEBTREEVIEW

%WEBTREEVIEW%

other options

you may want to consider using a parameterise INCLUDE instead - at least until someone works out how to make this work smile

for an example, see the BugsContrib - and the way we call the Tabulator topic

-- SvenDowideit - 24 Apr 2007

Closing this after more than 30 days inactivity; re-open if needed...

-- PeterThoeny - 02 Jun 2007

Change status to:
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2007-06-02 - PeterThoeny
 
  • 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.