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

John Feezell JohnFeezell at 3wplace.com
Fri Apr 15 07:37:48 CDT 2005


Pm after look at FmtPageList I feel a little bit like Miss Blueberry of 
Vegetales when she went to Shopmart:  she felt "so wooooozy."  That some 
function.

Here's my progress so far:

Created the following function:
------------------------------------
function SimpleRawList($pagename,&$pagelist,$opt) {
 global $FmtV;
  $out = array();
  foreach($pagelist as $item) {
    $out[] = $item['pagename']; }  
$FmtV['$RawList']=$out;
  return $out;
}
---------------------------------
The $out return didn't make it back to my calling function, so I used 
the $FmtV array to pass the results back.

Next I included the following in my calling function:
--------------------------------
 $Tsearch="Forms/Phone";
 $FPLFunctions['raw']='SimpleRawList';
$FoundThese = 
FmtPageList('$MatchList',$pagename,array('o'=>PSS($Tsearch), 'req'=>1, 
'fmt'=>'raw'));
-------------------------------
To make this setup return my search I found that I needed to include a 
(:searchresults Forms/Phone:) on the page with the markup that calls my 
markup.  I've looked at the code and tracked it but can't see any 
difference in the working of FmtPageList with and without the 
searchresults markup.

You can see this is operation at:
<http://cbfa-cos.org/xwiki/Forms/BundleSample>
If you edit the page, you can delete the (:searchresults ...:) markup 
and see the effect I'm talking about.

What am I missing?  I think that something is missing from my 
SimpleRawList function.
How far am I off the 'beaten path?' 

Thanks.

/JF

John Feezell wrote:

> Thanks Pm, I'll check it out and raise any questions I may have after 
> I've had a chance to review it.
>
> /JF
>
> Patrick R. Michaud wrote:
>
>> 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
>>
>>
>>
>>  
>>
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://pmichaud.com/mailman/listinfo/pmwiki-users
>
>
>




More information about the pmwiki-users mailing list