[pmwiki-users] Excluding anything but Main group from searches

Hans design5 at softflow.co.uk
Thu May 10 08:24:19 CDT 2007


Thursday, May 10, 2007, 1:32:57 PM, Patrick R. Michaud wrote:

> Isn't it just...?

>     $SearchPatterns['default']['main'] = '/^Main\./';
>     $SearchPatterns['default']['sandbox'] = '!^Main\.WikiSandbox$!';

Hmm, yes, thank you! I chnaged it to:

if(CondAuth($pagename,'read')) {
    $SearchPatterns['default']['main'] = '/^Main\./';
    $SearchPatterns['default']['sandbox'] = '!^Main\.WikiSandbox$!';
    $SearchPatterns['default']['pagetopmenu'] = '!^Main\.PageTopMenu$!';
    $SearchPatterns['default']['sidebar'] = '!^Main\.SideBar$!';
}    

if(CondAuth($pagename,'edit')) {
    $SearchPatterns['default']['main'] = '/^.*\./';
    $SearchPatterns['default']['sandbox'] = '';
    $SearchPatterns['default']['pagetopmenu'] = '';
    $SearchPatterns['default']['sidebar'] = '';    
}

in order to get full search results if logged in as editor.

Before I tried to set (:searchbox group=Main name=-WikiSandbox ...:),
but it needs to be done in Site.Search as well, for subsequent
searches.

I also changed the search fmt according to read or edit status, as a
visitor should not need to see

Main/
   Page1
   Page2
   etc

but rather see a #titlespaced format.

In any case there are changes to be made in various places, and it
would be good to document this. Maybe this needs a new Cookbook page?
WikiInDisguise?


  ~Hans




More information about the pmwiki-users mailing list