[pmwiki-users] How to search using a markup function.

Patrick R. Michaud pmichaud at pobox.com
Wed Apr 13 17:13:23 CDT 2005


On Wed, Apr 13, 2005 at 05:03:46PM -0500, John Feezell wrote:
> Looking for suggestions and guidance on the following:
> 
> Here's what I'd like to be able to achieve.
> 1.  A user sets a search string via a custom markup - now working.
> 2. The function that handles the markup grabs the search string (now 
> working) and passes it to PmWiki to process the "search".
> 3. PmWiki return the list of the "found" pages via a variable to the 
> markup function.
> 4. The markup function continues processing the markup using the 
> variable returned by PmWiki.
> 
> I've looked at the (:searchbox::) markup, etc but it was unclear to me 
> know the "search" was processed.  I believe that the variable I'd like 
> to access is the resulting $MatchList variable. 

Actually, you probably want to look at (:searchresults:) or (:pagelist:)
instead, as they're the ones that perform the actual search.  (:searchbox:)
just generates the form for someone to fill in.

> The central idea is to process and working with a "search" that is 
> started and mananged by the markup function rather than the user.  The 
> user simply specifies the "search string" via the markup.

At the moment this is handled slightly differently -- the FmtPageList()
function grabs the list of pages according to various search criteria,
then passes that list to an output formatting function specified
by the markup (which can be a custom markup).  

I did think about doing it the way you describe, where a markup-specific 
function calls something to get the set of matching pages and then 
formats the output, but at the time I decided it was too inefficient 
(and searches are already too slow anyway) and less flexible than the 
one I chose.

However, FmtPageList and friends are next on my "hit list" for improvements,
so there may be a better answer for you here before I'm through.
Still, I'd suggest making use of FmtPageList (feel free to ask questions
about it).

Pm



More information about the pmwiki-users mailing list