lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markharw...@yahoo.co.uk
Subject Re: Highlighter package v2 RC1
Date Sat, 10 Apr 2004 12:44:49 GMT
>>Can I customize the way it does highlight terms? Right now it does so by arounding
with <b>.
That's the job of a formatter class. You can pass one in the constructor eg:

Formatter myFormatter=new SimpleHTMLFormatter("<i>","</i>");
Highlighter h=new Highlighter(myFormatter, new QueryScorer(query)));

If you look at the formatter interface you can see it is now passed scores for each token.
You could provide a Formatter implementation which coloured words with different colour intensity

based on these scores if that was a useful effect.



>>Second, I miss the ability to let it highlight all fields or a selection or several
fields 

Just concatenate them:

String textToBeHighlighted=field1Text+field2Text..;

and then send that to the highlighter, no?


>>What am I going to do if I want the entire text to be highlighted - and not fragmented?

Use one big fragment...

highlighter.setTextFragmenter(new SimpleFragmenter(1000000));

Cheers
Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message