[pmwiki-users] Quick pagename search?

Oliver Betz list_ob at gmx.net
Fri Mar 2 03:32:54 CST 2007


Patrick R. Michaud wrote:

[...]

> > > How would you like to specify a pagename substring search box?
> > 
> > One possibility would be to extend the (:searchbox:) directive with a 
> > (pseudo) variable for the search term, e.g. the "q" already used as 
> > HTTP GET variable. This way one could put some text around the user 
> > entry, like "name=*$q*". Maybe there are other uses for this.
> 
> We've discussed having variables for query terms... but I don't
> think that really solves the problem in a robust way.  What if 
> $q has spaces in it, or represents multiple terms, or has other 
> options included in it?

I see - my workaround is not robust.

> I think my question is a bit broader than the answer given here...
> I'm not really asking how to make it work within the directives
> available -- I'm asking "how should it look"?  In particular,
> if (:searchbox:) is what we use to search page contents, perhaps
> something like (:pagebox:) or (:titlesearch:) or something like
> that is the way to go.
> 
> Or perhaps we just specify a pagelist option that identifies
> what is to be searched by the search terms.  PmWiki's current
> default would be "name,text,targets", but we could have an
> option that limits the search to titles or names:
> 
>     (:searchbox fields=name:)

which would be more flexible as far as I see.

> > The "put me directly to the page if there is only one hit" behaviour 
> > might indeed require another option. What about making $MatchCount / 
> > {$$PageCount} accessible as page variable, then one could make a 
> > conditional redirect?
> 
> {$$PageCount} is already a page variable.  Thus, I think it would work 
> to have the following in a pagelist template (using the new syntax):

o.k. - I didn't realize that it has to be in a template to be valid.

>     (:template last:)
>     (:if equal {$$PageCount} 1:)(:redirect {=$FullName}:)
> 
> So, if there's only one page in the results, the browser is 
> immediately redirected to it.  
> 
> Using PmWiki's existing template syntax, this would be:
> 
>     (:if expr equal {>$Group} "" && equal {$$PageCount} 1 :)
>     (:redirect {=$FullName}:)

the redirect doesn't seem to work - it's simply displayed as 
(:redirect PmWiki.SomePage:).

For a "production" version I would also dislike a "(redirected from" 
message in the target page.

Oliver
-- 
Oliver Betz, Muenchen




More information about the pmwiki-users mailing list