You are here: Foswiki>Tasks Web>Item4784 (02 Dec 2014, GeorgeClark)Edit Attach

Item4784: SEARCH result has an extra separator at the end

pencil
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: minor
Applies To: Engine
Component:
Branches:
Reported By: TWiki:Main.CrawfordCurrie
Waiting For:
Last Change By: GeorgeClark
I wanted to make a search such that I could use the result in a regular expression, so I selected the separator |. Here's what happened:

%SEARCH{"Etruscan Art" format="$topic" separator="|"}% :
Searched: Etruscan Art
Item4784
Number of topics: 1

As you can see, there is an extra | at the end of the list, which makes the RE unusable. The separator should separate the search terms, it shouldn't also terminate the list.

-- TWiki:Main/CrawfordCurrie - 08 Oct 2007

First result of debugging: There are at least two bugs.
  1. The code tries to remove the final separator around Search.pm line 1023, but at this place the summary "Number of topics" is already in place.
  2. Using nototal="on" doesn't help at all, of course, because the separator has a meaning in a regex (try separator="*" for a more disastrous example of this error). The second bug needs to be fixed by enclosing the regexp with \Q$separator\E$, for the first it is now too late.

-- TWiki:Main.HaraldJoerg - 08 Oct 2007


It emerges that it's due to the way the list of results is built. There is code to remove the trailing separator from the list (this is a really bad way to build a list, but oh what the hell)

Solution was to quotemeta the string used in the replacement RE, which was the second of Harald's suggestions and seems to fix it.

CC


Not yet "Waiting for Release"! It doesn't work unless you set nototal="on"!

It could be lowered to "Normal", though, because it is unlikely that a formatting application can do with the "Number of topics" string, but not with a trailing separator.

-- TWiki:Main.HaraldJoerg - 08 Oct 2007

OK, sorry, I didn't understand your report before. Lowered to Normal.

CC

This item has targetrelease minor (which is getting closer), but no waiting for?

-- TWiki:Main.SteffenPoulsen - 22 Dec 2007

Based on the example above, this seems to be resolved. The example doesn't have the trailing separator.

-- GeorgeClark - 02 Dec 2014

ItemTemplate edit

Summary SEARCH result has an extra separator at the end
ReportedBy TWiki:Main.CrawfordCurrie
Codebase
SVN Range TWiki-4.3.0, Sat, 06 Oct 2007, build 15172
AppliesTo Engine
Component
Priority Normal
CurrentState No Action Required
WaitingFor
Checkins TWikirev:15210 TWikirev:15211
TargetRelease minor
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release01x01Checkins
Topic revision: r13 - 02 Dec 2014, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy