how can I get a pagename substring search box instead of or in
addition to the full text search box?
I know that I can enter "name=*term*" in the default searchbox, but
that's inconvenient, and many users can't remember it.
There were some discussions about this, but I found no "ready to use"
solution.
Oliver
--
Oliver Betz, Muenchen
_______________________________________________
pmwiki-users mailing list
pmwiki...@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users
> how can I get a pagename substring search box instead of or in
> addition to the full text search box?
well, I hacked it, but I don't like it. Any hints to make it cleaner
are welcome.
An input form calls a TitleSearch page where I use the HTTP GET
variable to form the correct search pattern:
(:input form method=get action={$ScriptUrl}/Site/TitleSearch:)
(:input text name=tsq:)
(:input end:)
And TitleSearch contains:
(:if !equal {$tsq} '':)
(:pagelist name=*{$tsq}*:)
(:ifend:)
Since I didn't know a better way to access GET variables, I added
$FmtPV['$tsq'] = htmlspecialchars($_GET['tsq']);
to config.php. I feel there has to be a cleaner way, any hint?
Besides this, I would prefer a title search with additional
functionality like in PhpWiki: if there is only one matching page,
the user should be forwarded directly to this page.
This is a very conventient navigation method - you need little
keystrokes and mouse clicks if you know a unique part of the
pagename.
For example, if you have to edit the "DocumentationIndex" repeatedly,
it could be sufficient to type "oni" in the TitleSearch field. I use
this all the time in my PhpWiki and wouldn't like to miss it.
How would you like to specify a pagename substring search box?
In other words, what sort of markup or option to pagelist would
make the most sense to you (as an author) to mean "do a search
of pagenames only"?
Implementation for this is very easy -- all I need is a suitable
markup.
Pm
> > how can I get a pagename substring search box instead of or in
> > addition to the full text search box?
> >
> > I know that I can enter "name=*term*" in the default searchbox, but
> > that's inconvenient, and many users can't remember it.
>
> 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.
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?
Oliver
--
Oliver Betz, Muenchen
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 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:)
> 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):
(: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}:)
Pm
> 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:)
This would be great. It avoids needing another markup for this.
The word "field" may look a little strange. It refers to the page file
lines, i.e. $page['name'], $page['text'] etc ?
When I hear "fields" I think of forms. The page file structure is not
normally referred to. Technically they are $page array values I guess?
I just don't know what we call these, but perhaps there is a better
term than "fields".
Hans
The page array values are called "attributes", but I wasn't
necessarily limiting the "fields=" parameter to page attributes.
In other words, it may also be that we want to allow page variables
to appear here, as in:
## search for terms in pagenames and $:Summary
(:searchbox fields=name,$:Summary:)
Yes, this would give us two different ways to select pages
based on page variables... but what's wrong with that? ;-)
I agree that a term other than "fields" would be better -- that's
all I could come up with on short notice. But I'm also not
intending to limit it to $page array values.
Pm
> I agree that a term other than "fields" would be better -- that's
> all I could come up with on short notice. But I'm also not
> intending to limit it to $page array values.
trying to brainstorm:
scope
area
zone
Hans
Well why not the word you just used above in the comment?
-> "terms"
Kathryn Andersen
--
_--_|\ | Kathryn Andersen <http://www.katspace.com>
/ \ |
\_.--.*/ | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
v |
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha! | -> Earth -> Sol -> Milky Way Galaxy -> Universe
> Well why not the word you just used above in the comment?
->> "terms"
but "terms" is what you put into the searchbox. It is the scope
of the search which gets defined, or set, or limited.
Hans
[...]
> > > 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
Ah, you're correct -- redirects aren't currently enabled within
pagelists. I'll add this capability.
> For a "production" version I would also dislike a "(redirected from"
> message in the target page.
One can turn off the "redirected from" message entirely by using
$PageRedirectFmt = '';
Pm