Re: [pmwiki-users] Excluding anything but Main group from searches
On Thu, May 10, 2007 at 01:24:21PM +0100, Hans wrote: Do we have comprehensive documentation about how to exclude anything but the Main group pages from searches? Isn't it just...? $SearchPatterns['default']['main'] = '/^Main\./'; $SearchPatterns['default']['sandbox'] = '!^Main\.WikiSandbox$!'; Pm ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Excluding anything but Main group from searches
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 ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Excluding anything but Main group from searches
On Thu, May 10, 2007 at 02:24:19PM +0100, Hans wrote: 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. I would've done the above as: if (!CondAuth($pagename, 'edit')) { $SearchPatterns['default']['main'] = '/^Main\./'; $SearchPatterns['default']['sandbox'] = '!^Main\.WikiSandbox$!'; $SearchPatterns['default']['pagetopmenu'] = '!^Main\.PageTopMenu$!'; $SearchPatterns['default']['sidebar'] = '!^Main\.SideBar$!'; } In other words, limit the search only if the person doesn't have edit permissions. Before I tried to set (:searchbox group=Main name=-WikiSandbox ...:), but it needs to be done in Site.Search as well, for subsequent searches. It can be done in Site.Search only -- it doesn't have to go in the searchbox. 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? Sure, or perhaps just 'SingleGroupWiki' . Pm ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Excluding anything but Main group from searches
On Thu, May 10, 2007 at 06:27:37PM +0100, Hans wrote: Thursday, May 10, 2007, 2:48:34 PM, Patrick R. Michaud wrote: I would've done the above as: if (!CondAuth($pagename, 'edit')) { $SearchPatterns['default']['main'] = '/^Main\./'; $SearchPatterns['default']['sandbox'] = '!^Main\.WikiSandbox$!'; $SearchPatterns['default']['pagetopmenu'] = '!^Main\.PageTopMenu$!'; $SearchPatterns['default']['sidebar'] = '!^Main\.SideBar$!'; } In other words, limit the search only if the person doesn't have edit permissions. Thanks! One other thing: How do I customise the searchresults string xxx pages found out of yyy pages searched. If the search does not show pages from Pmwiki and Site, I don't want the total number displayed. A small site with a dozen or so pages shows over a hundred pages searched. May make a visitor wonder what are all those pages? $SearchResultsFmt = div class='wikisearch'$[SearchFor] div class='vspace'/div\$MatchList/div; You can also provide a custom $[SearchFound] translation. Pm ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users
Re: [pmwiki-users] Excluding anything but Main group from searches
Thursday, May 10, 2007, 6:31:36 PM, Patrick R. Michaud wrote: $SearchResultsFmt = div class='wikisearch'$[SearchFor] div class='vspace'/div\$MatchList/div; You can also provide a custom $[SearchFound] translation. Thank you. It actually worked fine and showed only the total number of pages in the Main group, as specified with default patterns. I just fell into the trap of not logging out to see it, and as I was logged in as editor I did see all site pages! ~Hans ___ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users