Tags:
create new tag
view all tags

Question

Hi, right now I have a page that searches the SandBox for all pages ending in "Def" (definitions), and lists the Topic followed by the Summary.

%SEARCH{ "Def" web="Sandbox" scope="topic" nosearch="on" nototal="on" order="topic" topic="*Def" header="---+ Definitions" format="[[$topic]]: $summary$n()" }%

Is there a way to display just part of the summary, or to specify which region of Topic body to be considered the "summary"?

For example, if my page BlahDef consists of Intro, Purpose, Description sections, can I make a formatted search display "BlahDef: {Purpose}" ? Thanks!

Environment

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

-- TWikiGuest - 23 May 2005

Answer

There are several options:

  • Displaying part of a summary - see $summary(50) varible in FormattedSearch .
  • Defining your own "summary" section of topic - yes, the approach you mention should work.
  • Create a web form with TopicSummary field and use $formfield variable.

You might also look over discussion in AllowDesignationOfSummary for more ideas.

-- LynnwoodBrown - 23 May 2005

Thank you for the help Lynnwood, could you please elaborate on the second method, defining my own "summary" section? Would I wrap the part of the topic with some TWiki variables or how...? Thanks again!

-- TWikiGuest - 24 May 2005

Here's one approach to defining your own summary section in a topic (someone else may have a more eloguent approach). In your definition topic bracket the text you want to use as the summary with html comments such as this:

<!-- begin summary -->
Here's the text to use as summary.
<!-- end summary -->

Then, in your FormattedSearch, use the $pattern variable with this search string:

$pattern(^.*?summary -->(.*?)<!-- end.*)
I haven't tested this exact search definition (and regexes can be tricky) but I think it should work.

As an aside, you could define a template topic for the definition topics that would automatically insert the summary definition tags. You might check out my TopicClassificationAddOn for a framework that makes this easy and includes a CreateNewTopic "wizard" to make it really easy for users to add new definitions.

-- LynnwoodBrown - 24 May 2005

Thank you Lynnwood, it works perfectly!

-- TWikiGuest - 26 May 2005

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2005-05-26 - TWikiGuest
 
  • 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.