Skip to main content.
home | support | download

Back to List Archive

Re: [swish-e] ignoring accents in searches

From: Peter Karman <peter(at)not-real.peknet.com>
Date: Mon Dec 10 2007 - 16:09:56 GMT
On 12/10/2007 08:42 AM, Bill Moseley wrote:
> On Sun, Dec 09, 2007 at 04:19:38PM +0100, Louis-David Mitterrand wrote:
>> When using the search form at http://www.lesculturelles.net/search.md if 
>> you try après (or apres or precieuse) no highlighted word appear. For 
>> some words, like père (or pere) highlighting sill happens. These 
>> discrepancies didn't occur before using "TranslateCharacters :ascii7:".
> 
> Hum, I'm not sure it can work without modifying how the highlighting
> code works.  I suspect it looking for apres and the text contains après
> so it can't match.
> 
[snip]
> You may need to convert each word while highlighting in the same way
> that swish does when indexing.  I see there's a method in SWISH::API
> called "swish_words" which is suppose to do that, but it says "Not
> implemented".  You may be able to simply add a "tr ///" to translate
> the characters for each $phrase.
> 

If you can't get the highlighting code in the swish-e dist to work for you, consider using
Search::Tools. The problem AFAIK is that swish-e will transliterate the query string
itself in order to match how the original docs were indexed. Thus the query used for
highlighting has already gone through the equivalent of tr///. If you used Search::Tools,
you could pass the original query into the relevant constructor and then highlight the
original text with the un-transliterated text. One potential problem though is that your
users may enter ascii text directly (already transliterated) and then the highlights will
fail anyway, even searches will work.

NOTE: I would not recommend SWISH::HiLiter (also on cpan with Search::Tools) as it will
inherit the same problem that the current swish-e highlighting code does.


-- 
Peter Karman  .  peter(at)not-real.peknet.com  .  http://peknet.com/

_______________________________________________
Users mailing list
Users@lists.swish-e.org
http://lists.swish-e.org/listinfo/users
Received on Mon Dec 10 11:09:56 2007