I'm trying to store semantic information in payloads at index time. I believe
this part is successful - but I'm having trouble getting access to the payload
locations after the index is created. I'd like to know the offset in the
original text for the token with the payload - and get this information for all
payloads that are set in a Field even if they don't relate to the query. I
tried (from the highlighting filter):
TokenStream tokens = TokenSources.getTokenStream(reader, 0, "body");
while (tokens.incrementToken()) {
TermAttribute term = tokens.getAttribute(TermAttribute.class);
if (toker.hasAttribute(PayloadAttribute.class)) {
PayloadAttribute payload = tokens.getAttribute(PayloadAttribute.class);
OffsetAttribute offset = toker.getAttribute(OffsetAttribute.class);
}
}
But the OffsetAttribute never seems to contain any information.
In my token filter do I need to do more than:
offsetAtt = addAttribute(OffsetAttribute.class);
during construction in order to store Offset information?
Thanks,
-Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]