lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Klaas" <mike.kl...@gmail.com>
Subject Re: Better highlighting fragmenter
Date Thu, 04 Jan 2007 06:03:27 GMT
On 1/3/07, Walter Underwood <wunderwood@netflix.com> wrote:
> On 1/3/07 9:33 PM, "Yonik Seeley" <yonik@apache.org> wrote:
>
> > On 1/3/07, Walter Underwood <wunderwood@netflix.com> wrote:
> >> We tried several APIs and decided that the best was an array of
> >> String with the odd elements containing the strings that needed
> >> highlighting.
> >
> > Good idea... the only thing I could think of was an array of start/end
> > offsets into the string, which is harder to read and probably harder
> > to deal with.
>
> Yep. The client code for the even/odd List is really simple.
> Something like this:
>
> for (int i=0; i<list.size(); i++) {
>     if (i%2 == 1) sb.append("<b>");
>     sb.append(handyXmlQuotingMethod(list.get(i)));
>     if (i%2 == 1) sb.append("</b>");
> }

We wouldn't even have to complicate the API -> just trigger this
functionality based on hl.formatter.  hl.formatter=interleave?

-Mike

Mime
View raw message