You are here: Foswiki>Tasks Web>Item765 (03 Jul 2009, MichaelDaum)Edit Attach

Item765: Search in the topbar is not working (quickfix available)

pencil
Priority: Normal
Current State: Closed
Released In:
Target Release:
Applies To: Extension
Component: NatSkinPlugin
Branches:
Reported By: MichaelDaum
Waiting For:
Last Change By: MichaelDaum
The search in the topbar is not working. After you enter a keyword and press enter you just get redirected to the same topic again

Quickfix: Please add the following to your lib/LocalSite.cfg
$Foswiki::cfg{SwitchBoard}{natsearch} = ['TWiki::Plugins::NatSkinPlugin::Search', 'searchCgi', {natsearch => 1}];

Further investigations: Finding out why the engine fails to derive the correct action for a non-standard cgi script, i.e. one without a switchboard entry.

See also: Item958


Please activate the DEBUG flag in line 25 of lib/TWiki/Plugins/NatSkinPlugin/Search.pm and report its output here. I can't reproduce the error so far.

-- MichaelDaum - 15 Jan 2009

After further investigation I found out that this is probably a bug in the way the core engine derives the actual "action" (edit, view, login, save, .... natsearch) from the request. All standard actions do have a switchboard entry and thus the action is well defined. For non-standard actions like natsearch the engine tries to derive it from the PATH_INFO environment variable. If it does not find a valid action in there it defaults to the view action. However, the PATH_INFO does not necessarily contain the hint to the actual action, i.e. using short urls. The real info is in the REQUEST_URI - not in the PATH_INFO as far as I can see. However

For instance, for a http://..../login/Main/WebHome, I get

  • PATH_INFO = /login/Main/WebHome
  • REQUEST_INFO = /login/Main/WebHome
  • action = login (correct)
However, for http://.../natsearch/Main/WebHome, I get

  • PATH_INFO = /Main/WebHome
  • REQUEST_INFO = /natsearch/Main/WebHome
  • action = view (wrong)
Question is: why does natsearch not appear on the PATH_INFO in the second case / why does it get stripped off?

-- MichaelDaum - 15 Jan 2009

$Foswiki::cfg{SwitchBoard}{natsearch} = ['TWiki::Plugins::NatSkinPlugin::Search', 'searchCgi', {natsearch => 1}];

That hotfixed it for me, or better for the VM. Thank you

-- EugenMayer - 15 Jan 2009

Okay, recasting it to "Egine".

-- MichaelDaum - 15 Jan 2009

Here's what I've found out: you will either have to set FOSWIKI_ACTION in the cgi script or defined a SwitchBoard entry. That is old-style cgi scripts, that haven't got either of it don't work on foswiki.

I will add a FOSWIKI_ACTION to natsearch to fix NatSkin for now.

-- MichaelDaum - 15 Jan 2009

Hi Michael,

Take a look at Development.FoswikiStandAlone#Note_to_Extension_Developers and Item714. Probably this issue is already solved.

Notice that REQUEST_URI is not RFC-Compliant and it's not available in some web severs. Your question about why natsearch is stripped from PATH_INFO depends on your setup... the PATH_INFO is the extra path after the script name. When you're using fastcgi, the bin dir is mapped to foswiki.fcgi and the action is part of PATH_INFO. When you're using plain CGI, the action is the script and it's not part of PATH_INFO. A FSA-Compliant action should meet two conditions:
  • Add an entry to =$Foswiki::cfg{SwitchBoard} (so engines other than CGI recognizes the new action)
  • Provide a cgi script similar to the core ones (it should adjust $Foswiki::cfg{Engine}, load Foswiki and Foswiki::UI and call $Foswiki::engine->run()

A legacy CGI script will work, after the addition of Foswiki::Engine::Legacy.

-- GilmarSantosJr - 09 Feb 2009

Okay, natsearch works fine now calling it as a normal cgi. Using FSA will need the switchboard entry. Will add this to the docu.

-- MichaelDaum - 11 Feb 2009

Added to documentation.

-- MichaelDaum - 03 Jul 2009

ItemTemplate edit

Summary Search in the topbar is not working (quickfix available)
ReportedBy MichaelDaum
Codebase trunk
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component NatSkinPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins
ReleasedIn
Topic revision: r10 - 03 Jul 2009, MichaelDaum
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