[pmwiki-users] Custom searchbox

Patrick R. Michaud pmichaud at pobox.com
Wed Oct 18 13:14:52 CDT 2006


On Wed, Oct 18, 2006 at 05:49:56PM +0000, Pico wrote:
> Patrick R. Michaud <pmichaud <at> pobox.com> writes:
> 
> > 
> > On Wed, Oct 18, 2006 at 05:22:04PM +0000, Pico wrote:
> > > [...]A question in PmWiki/Questions is looking for a 
> > > use-friendly way to limit searches to the text of PageName, 
> > > without requiring visitors to know about searchbox parameters
> > > and wildcards.
> > > 
> > > Background:
> > > 
> > > For example, assume that you want to search for pages whose 
> > > *name* contains the string "Foo" .
> > > [...]
> > 
> > Why not just...?
> > 
> >     (:searchbox name=*Foo* :)
> 
> Because we don't want to hardcode the string "Foo" into the searchbox.  

Oh, I understand now what you mean.  You want a searchbox that only
searches pagenames, and not page text.

I don't think there's a way to do this entirely in the core -- 
but one could get quite close with:

    (:input form:)
    (:input text name='name':)
    (:input hidden name='action' value='search':)
    (:input end:)

But then the searcher would have to enter "*Foo*" to get all
pagenames containing Foo, as entering a simple "Foo" would return
only the pages named (exactly) "Foo".

Yes, it could likely be done with something like the HttpVariables
recipe, where it could be placed in the searchresults as:

    (:searchresults name=*{$?q}* :)

Pm





More information about the pmwiki-users mailing list