[pmwiki-users] Search for terms with ss and ß

Hans Bracker design at softflow.uk
Mon Feb 6 12:27:20 PST 2023


How to match 'Baer' to 'Bär'? Which was what I wondered in my previous message. 

The only solution I got so far is this:

1. Use of a custom function to create aliases for search terms which contain accents and german umlauts. Like your UnaccentUTF8 pagelist search recipe, but without the folding to lower case.
    Searching  'Bär' will  find 'Bär' and also 'Baer'. All accented characters stay in the result display.

2. Use of a StrRestoreFunction to create reverse aliases for search terms in plain ascii. But this needs to be very language specific. So for German text I can use a translation array with
  'ae'=>'ä',  'oe'=>'ö',  'ue'=>'ü',  'Ae'=>'Ä',  'Oe'=>'Ö',  'Ue'=>'Ü' , ''ss => 'ß'
Now searching for 'Baer' will also find 'Bär'.

3. Use your UnaccentUTF8 recipe including the ä|ö|ü|Ä|Ö|Ü replacements for making of page list. This is needed to get the page matches right.

This seems to deliver acceptable results, highlighting works fine. Also, important for me, case sensitive or case insensitive search works.

And I did not need to fold text lines to get the correct matches.
But it needs language specific custom arrays for the StrRestoreFunction, for Swedish one might want to restore  'oe' to 'ø' for example.

~Hans




More information about the pmwiki-users mailing list