[pmwiki-users] SearchExtensions

John Rankin john.rankin at affinity.co.nz
Wed Jul 27 20:14:31 CDT 2005


On Thursday, 28 July 2005 1:57 AM, K.A.Bouton <k.a.bouton at reading.ac.uk> wrote:
>> Try downloading the latest version of search2.php from the 
>> Cookbook.SearchExtensions and see if that makes a difference.
>
>Done - and no it doesn't seem to make a difference unfortunately.
>In fact seems worse :)
>
>Here is the url
>http://www.cgam.nerc.ac.uk/pmwiki/NMM
>

I believe I might know what the problem is!

Are you using the searchterms recipe to highlight 
search terms in the resulting pages?

If so, try changing 

$words[$w]++; to $words[preg_replace('/^.*?\\//','',$w)]++;

in the foreach(preg_split(... statement of that script.

The problem only occurs if the search term has a '/' in it.
This messes up the following statement:
Markup('searchterms', '>restore',
  "/\\b($words)\\b(?![^<]*>)/i",
  "<font class='searchterms'>$1</font>");

producing, for example

 pat=/\b(Main/comments)\b(?![^<]*>)/i

The / causes the pattern to end, and the c generates an error.
The search was for 'Main/comments'.

The proposed change removes any text up to and including a /.

>Curious if this is worth our effort if action=search is to be implemented
>which will do what I want - ie just get the search results returned within
>the field it was searching

Well, if I am doing something wrong, I'd like to learn, so I can avoid
making the same mistake again in future. In this case, I think it's the
searchterms recipe that's mis-interacting with the searchextensions.

If my hypothesis is correct, the problem will occur if a regular search
(using PmWiki's standard search feature) includes a Group/ qualifier.
I think.

Let me know how you get on.
>
>Anyway - willing until then
>Katherine
>
>


-- 
JR
--
John Rankin






More information about the pmwiki-users mailing list