00897: (:searchresults options:) bug

Summary: (:searchresults options:) bug
Created: 2007-03-02 04:32
Status: Closed - replied
Category: Change request
From: Francis
Assigned:
Priority: 432
Version: 2.2.0.beta31
OS:

Description: Using options for searchresults causes the options to be returned in the search query repetition.

e.g.

(:searchresults group=main fmt=#search:)

Results in the text Results of search for group=main fmt=#search your text

Solution:

I fixed this by editing the following line in pagelist.php

  • 'SearchFor' => 'Results of search for <em>$Needle</em>:',
    • becomes
      • 'SearchFor' => 'Results of search for <em>$SearchQuery</em>:',

Better solution

Add to config.php: XLSDV('en', array('SearchFor' => 'Results of search for <em>$SearchQuery</em>:')); ...and fix any language packs you have installed. This will then survive any core PmWiki updates.

Another place where this fails

http://www.pmwiki.org/wiki/Test/SearchParamsLeak

$Needle gets "dirtied" by the sub-pagelist parameter.


Suggestion: create a new directive rather than change the behavior of (:searchresults:)

To me, the current behavior is a feature, not a bug. Searches are not always for strings, and even when they are the other parameters may be vital to understanding the results. For example, if you search for "group=Main" you want to see "Results of search for group=Main" not "Results of search for" or even "Results of search".

It would be great to allow a choice about what is displayed for SearchFor at the searchbox level, so searches can display whichever makes the most sense. I suggest creating a (:searchqueryresults:) directive that would do that. But please don't remove the ability to show the Needle. RandyB August 17, 2010, at 02:40 PM