[Xapian-discuss] phrase search highlighting

Olly Betts olly at survex.com
Thu Mar 10 13:15:18 GMT 2011


On Thu, Mar 10, 2011 at 01:36:40PM +0100, Reini Urban wrote:
> So I had to disable phrase highlighting at all like this:
> 
> query:
> <!-- highlight only if Query does not contain PHRASE -->
> $if{$eq{$substr{$query,0,1},"},$field{sample},$highlight{$field{sample},$terms}}$if{$field{sample},...}

You really want $html{$field{sample}} for the first occurrence there,
so that characters get escaped properly ($highlight does this as well
as highlighting).

This (untested) approach should spot any phrase (including ones from
hyphenation, etc):

$if{$find{$list{$querydescription},PHRASE},$html{$field{sample}},$highlight{$field{sample},$terms}}$if{$field{sample},...}

> If time permits please adjust omega highlighting for phrases. My time
> is currently very limited unfortunately.

Yes, it would be good to handle this.  Can you open a ticket please?

Cheers,
    Olly



More information about the Xapian-discuss mailing list