lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabiano Nunes <fabi...@nunes.me>
Subject Re: Retrieving payload attribute in highlighter
Date Tue, 30 Nov 2010 16:06:09 GMT
I've figured out the PayloadSpanUtil class. It's exactly what I'm expecting.
But, I'm concerned about the warning message in API docs (indeed, I think I
dont understand it). There is any other approach? Can I have the same
results retrieving the termPositions without performance issues?

Thanks.

On Tue, Nov 30, 2010 at 1:20 PM, Fabiano Nunes <fabiano@nunes.me> wrote:

> Hello,
> I'm trying to retrieve payloads from the highlighteds terms by Highlighter
> class. In my tests, all terms returned from Highlighter has null as payload.
> Example:
>
> Highlighter h = new Highlighter(new Formatter() {
> public String highlightTerm(String originalText, TokenGroup tokenGroup) {
> Token token = tokenGroup.getToken(0);
>  Payload payload = token.getPayload();
>  assertNotNull(payload); // <---------------- payload is always null
>  return originalText;
> }
> }, scorer);
>
> It seems that Highlighter removes payload attribute from all terms before
> creating its TokenGroup.
> How can I preserve it?
>
> Thanks.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message