logo       

Restricting search groups: msg#00124

web.wiki.pmwiki.user

Subject: Restricting search groups

On Sat, Jun 21, 2003 at 07:18:26PM +0100, Edward Andrews wrote:
>
> Is there a way to make the search page search only specified groups (a
> hidden way i mean that applies whatever the user specifies in the box)? If
> so it would mean that different sites, run on the same installation of
> pmwiki, could have separate search facilities.

Sure--add a control named "group" to the search form. If one is
present, then PmWiki limits its search to the value of this control
(however, someone can still search a different group by specifying
the group name as part of the search string).

For example, change the search markup output format in local.php with

$SearchTagFmt = "<form action='\$PageUrl' method='get'><input
type='hidden' name='group' value='\$Group' /><input
type='hidden' name='action' value='search' /><input type='text'
name='text' value='' size='40' /><input type='submit'
value='Search' /></form>";

The only difference between this and the default search tag is the
addition of the type='hidden' name='group' input element.

There's nothing that says the group control has to be a 'hidden' control,
it could also be specified by a checkbox, radio button, selection, text,
or textarea control.

At present there's no way to search a set of groups; you can either search
a single group or all of them. However, it wouldn't be too difficult for
me to modify search.php to allow multiple groups if that's needed.

I've also added this information to the Cookbook at
http://www.pmichaud.com/wiki/Cookbook/SearchGroup

Pm




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise