Tags:
create new tag
, view all tags

Implemented: Formatted Search with $summary()

The format="" of FormattedSearch already has a $summary that returns the first 162 characters of a topic in plain text, stripped of all markup. It supports now a $summary(options); the options are comma separated tokens:

  • 16 ... 512 indicates the number of characters shown in the summary
  • showvarnames shows the variables as VARIABLE and VARIABLE{...}; they are removed by default
  • noheader suppresses the headings at the beginning

Example: $summary(showvarnames, noheader, 50) shows a summary of 50 characters with stripped heading on top and stripped variables

Interactive Example:

$summary( )  

%SEARCH{ ".*" regex="on" order="modified" reverse="on" limit="10" nosearch="on" header="|*Topic: $summary*|*$summary()*|" format="|$topic:%BR% $summary|%BR%$summary()|" }%

Topic: $summary $summary()
WebStatistics:
Statistics for Codev Web See also: TWikiOrgStatistics, TWikiDownloadStatistics Month: Topic Views: Topic Saves: Attachment Uploads: Most...

Statistics for Codev Web See also: TWikiOrgStatistics, TWikiDownloadStatistics Month: Topic Views: Topic Saves: Attachment Uploads: Most...
KampalaReleaseMeeting2017x12x07:
Minutes of TWiki Kampala Release Meeting, 2017 12 07 Logistics, Participants, IRC log Date: Thursday, 2017 12 07 23:00 GMT (to your time zone) Location...

Minutes of TWiki Kampala Release Meeting, 2017 12 07 Logistics, Participants, IRC log Date: Thursday, 2017 12 07 23:00 GMT (to your time zone) Location...
KampalaReleaseMeeting2017x12x21:
Minutes of TWiki Kampala Release Meeting, 2017 12 21 Logistics, Participants, IRC log Date: Thursday, 2017 12 21 23:00 GMT (to your time zone) Location...

Minutes of TWiki Kampala Release Meeting, 2017 12 21 Logistics, Participants, IRC log Date: Thursday, 2017 12 21 23:00 GMT (to your time zone) Location...
KampalaReleaseMeeting2017x11x02:
Minutes of TWiki Kampala Release Meeting, 2017 11 02 Logistics, Participants, IRC log Date: Thursday, 2017 11 02 22:00 GMT (to your time zone) Location...

Minutes of TWiki Kampala Release Meeting, 2017 11 02 Logistics, Participants, IRC log Date: Thursday, 2017 11 02 22:00 GMT (to your time zone) Location...
KampalaReleaseMeeting2017x11x16:
Minutes of TWiki Kampala Release Meeting, 2017 11 16 Logistics, Participants, IRC log Date: Thursday, 2017 11 16 23:00 GMT (to your time zone) Location...

Minutes of TWiki Kampala Release Meeting, 2017 11 16 Logistics, Participants, IRC log Date: Thursday, 2017 11 16 23:00 GMT (to your time zone) Location...
TWikiOrgStatistics:
Monthly TWiki.org Statistics These are overall statistics across all webs. The latest numbers are also shown on the TWiki.org home page. See also SiteStatistics, OneYearSiteStatistic...

Monthly TWiki.org Statistics These are overall statistics across all webs. The latest numbers are also shown on the TWiki.org home page. See also SiteStatistics, OneYearSiteStatistic...
KampalaReleaseMeeting2017x10x19:
Minutes of TWiki Kampala Release Meeting, 2017 10 19 Logistics, Participants, IRC log Date: Thursday, 2017 10 19 22:00 GMT (to your time zone) Location...

Minutes of TWiki Kampala Release Meeting, 2017 10 19 Logistics, Participants, IRC log Date: Thursday, 2017 10 19 22:00 GMT (to your time zone) Location...
TestingTWikiThePerlWay:
Testing TWiki the Perl way In the current release, we stumbled over a problem which only manifests itself on Windows ( POSIX::tzset not available). Well, one could...

Testing TWiki the Perl way In the current release, we stumbled over a problem which only manifests itself on Windows ( POSIX::tzset not available). Well, one could...
KampalaReleaseMeeting2017x10x05:
Minutes of TWiki Kampala Release Meeting, 2017 10 05 Logistics, Participants, IRC log Date: Thursday, 2017 10 05 22:00 GMT (to your time zone) Location...

Minutes of TWiki Kampala Release Meeting, 2017 10 05 Logistics, Participants, IRC log Date: Thursday, 2017 10 05 22:00 GMT (to your time zone) Location...
TWikiPresentation2017x10x08Regex:
Presentation: Regular Expressions, To Match Or Not, That is the Question, Silicon Valley Code Camp, 2017 10 08 This is the presentation material for the talk on...

Presentation: Regular Expressions, To Match Or Not, That is the Question, Silicon Valley Code Camp, 2017 10 08 This is the presentation material for the talk on...
Number of topics: 10

Contributors:
-- PeterThoeny - 25 Sep 2004

Discussions

This is now implemented and in SVN, and also available on TWiki.org.

The implementation is based on some of the discussions found in AllowDesignationOfSummary.

For a TWikiApplication I needed the $summary(noheader) funtionality.

While we are at it, should we change the default summary shown in search? Possibly with the variables stripped by default? Or should that also be a TWikiPreferences setting?

-- PeterThoeny - 25 Sep 2004

I would vote to strip the variables. "TOC PUBURL / TWIKIWEB" is not useful when reading a summary. I wonder if it would ever be, perhaps someone can think of borderline cases.

-- ArthurClemens - 25 Sep 2004

It looks like it is better to remove the vars by default. That means, we should change the novariables option to showvariablenames. Opinions?

-- PeterThoeny - 25 Sep 2004

I vote for stripping them (or would if there was a vote button).

Actually, a simple improvement would be to show me something interesting in the summary - how about the text of the last diff?

-- MartinCleaver - 26 Sep 2004

Text of last diff: This is out of scope of this feature here; it has been discussed in AllowDesignationOfSummary

OK, the novariables option should change to showvariablenames.

-- PeterThoeny - 28 Sep 2004

SVN and TWiki.org are updated with the spec change: Reversed logic and renamed novariables to showvarnames.

-- PeterThoeny - 28 Sep 2004

Hmm, I am preaching compatibility for existing content but this enhancement broke one TWikiApplication at work that has nested searches. One outer search introduces newlines; the $n got evaluated one level too early. This code fixes the issue:

--- Search.pm   (revision 1762)
+++ Search.pm   (working copy)
@@ -965,10 +965,6 @@
                 $tempVal =~ s/\$formfield\(\s*([^\)]*)\s*\)/getMetaFormField( $meta, $1 )/geos;
                 $tempVal =~ s/\$formname/_getMetaFormName( $meta )/geos;
                 $tempVal =~ s/\$pattern\((.*?\s*\.\*)\)/getTextPattern( $text, $1 )/geos;
-                $tempVal =~ s/\$nop(\(\))?//gos;      # remove filler, useful for nested search
-                $tempVal =~ s/\$quot(\(\))?/\"/gos;   # expand double quote
-                $tempVal =~ s/\$percnt(\(\))?/\%/gos; # expand percent
-                $tempVal =~ s/\$dollar(\(\))?/\$/gos; # expand dollar
                 $tempVal =~ s/\r?\n/$newLine/gos if( $newLine );
                 if( $theSeparator ) {
                     $tempVal .= $theSeparator;
@@ -977,6 +973,10 @@
                 }
                 $tempVal =~ s/\$n\(\)/\n/gos;          # expand "$n()" to new line
                 $tempVal =~ s/\$n([^$mixedAlpha]|$)/\n$1/gos; # expand "$n" to new line
+                $tempVal =~ s/\$nop(\(\))?//gos;      # remove filler, useful for nested search
+                $tempVal =~ s/\$quot(\(\))?/\"/gos;   # expand double quote
+                $tempVal =~ s/\$percnt(\(\))?/\%/gos; # expand percent
+                $tempVal =~ s/\$dollar(\(\))?/\$/gos; # expand dollar

             } elsif( $noSummary ) {
                 $tempVal =~ s/%TEXTHEAD%//go;

This change is now in SVN.

-- PeterThoeny - 19 Oct 2004

Small follow-up in MainBranch to remove leading and trailing spaces, needed to get correct text alignment for summaries in table cells.

-- PeterThoeny - 09 Nov 2004

Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2005-02-13 - SamHasler
 
  • 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-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.