You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Scott Smith <ss...@mainstreamdata.com> on 2009/09/30 22:10:51 UTC
Highlighting phrases in 2.9
I've been looking at the changes I have to make in my code to go from
2.4.1 to 2.9. One of the features I have is to highlight query hits in
documents which meet the search criteria. If the query has a phrase,
then I need to highlight the phrase, but not isolated words from the
phrase which also happen to be in the document.
In 2.4.1, I do this using the SimpleHTMLFormatter, the NullFragmenter
and the SpanScorer. It looks like highlighter had a major overhaul in
2.9 and that SpanScorer is now the wrong scorer to use (it's been moved
out of the highlighter). I also found some JIRA's that seem to imply
that SpanScorer is now used by default, but I don't see anything in the
javadocs that say this is the case.
Do I just need to remove the SpanScorer completely and assume that the
highlighter takes care of that for me?
Can someone suggest what I need to do or point me to some documentation?
Re: Highlighting phrases in 2.9
Posted by Mark Miller <ma...@gmail.com>.
Scott Smith wrote:
> I've been looking at the changes I have to make in my code to go from
> 2.4.1 to 2.9. One of the features I have is to highlight query hits in
> documents which meet the search criteria. If the query has a phrase,
> then I need to highlight the phrase, but not isolated words from the
> phrase which also happen to be in the document.
>
>
>
> In 2.4.1, I do this using the SimpleHTMLFormatter, the NullFragmenter
> and the SpanScorer. It looks like highlighter had a major overhaul in
> 2.9 and that SpanScorer is now the wrong scorer to use (it's been moved
> out of the highlighter). I also found some JIRA's that seem to imply
> that SpanScorer is now used by default, but I don't see anything in the
> javadocs that say this is the case.
>
>
>
> Do I just need to remove the SpanScorer completely and assume that the
> highlighter takes care of that for me?
>
>
>
> Can someone suggest what I need to do or point me to some documentation?
>
>
>
>
The QueryScorer is now what the SpanScorer was - if you want what was
the QueryScorer before, use the TermQueryScorer.
If you want what was the SpanScorer, use the QueryScorer.
--
- Mark
http://www.lucidimagination.com
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org