Item11190: SEARCH does not handle %WEB, %TOPIC etc. variables in the right context in the output

Priority: Normal
Current State: No Action Required
Released In: 1.1.4
Target Release: patch
Applies To: Engine
Reported By: BeatDoebeli
Waiting For:
Last Change By: OlivierRaginel
When a SEARCH finds variables like %WEB%, %TOPIC%, %ATTACHURL% etc. in the results, they get interpreted in the wrong context: Not in the topic they were found but in the topic where the SEARCH is.

This is a different interpretation of the variables compared to TWiki (up to 4.1.2).

  • TestTopic44738 contains and displays an image.
  • TestTopic44739 contains a search which should show the image from above, but the generated URL for the picture is wrong.

-- BeatDoebeli - 20 Oct 2011

Sorry, after checking the code, it turns out there is a "new" (?) parameter to SEARCH called expandvariables. If you set it (as I did in your examples, in a copy), you will see that it's working as expected.

I'm afraid the migration will have to edit the SEARCHes and add this parameter, as we cannot default to 1. In fact, we could have, when this was introduced, but I guess we decided against it for performance reason. Funny nobody complained before.

-- OlivierRaginel - 20 Oct 2011


I guess we can improve documentation - probably as an FAQ item.

-- PaulHarvey - 20 Oct 2011

Agreed. Leaving this task open to ensure what we have now is really what we want, and to improve the documentation accordingly.

-- OlivierRaginel - 20 Oct 2011

No but wait... this parameter existed already, therefore my conclusions are wrong. The behavior changed, so are we happy with the way things are, or shall we change it?

-- OlivierRaginel - 20 Oct 2011

Which behaviour changed? The default for expandvariables?

-- PaulHarvey - 21 Oct 2011

Yes, the parameter already existed in TWiki 4.1.2 But it didn't expand all variables: %WEB% and %TOPIC% where not expanded.

So the actual foswiki behaviour is more logical but breaks with history.

I reccommend to leave it as it is now.

-- BeatDoebeli - 21 Oct 2011

Ok. As you reported it, I consider it as working as expected, and I'm closing this bug as no action.

Paul, I meant that under TWiki 4.1.2, %TOPIC% and %WEB% were expanded in the found topic context. Now, either they're not expanded, and therefore expanded in the search topic context, or they're expanded alongside all other variables (with the expandvariables parameter).

-- OlivierRaginel - 21 Oct 2011


ItemTemplate edit

Summary SEARCH does not handle %WEB, %TOPIC etc. variables in the right context in the output
ReportedBy BeatDoebeli
Codebase 1.1.3
SVN Range
AppliesTo Engine
Priority Normal
CurrentState No Action Required
Checkins distro:3f31259e8bd1 distro:c294ccd83bb3
TargetRelease patch
ReleasedIn 1.1.4
Topic revision: r10 - 21 Oct 2011, OlivierRaginel - This page was cached on 21 Jan 2021 - 02:19.

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