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 <fabi...@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. >