Hi there, I'm currently trying to work out how I can determine the type (string/number/date/etc)of a term. I've not seen any off the shelf way to do it so am trying to store a payload against each term that records the type.
I'm having a little trouble retrieving a payload I'd stored onto the term. At the moment I'm using the TypeAsPayloadTokenFilter, however I'll change this soon as it's not really what I'm after. I'm then getting a TermEnum from either reader.terms() or using a PrefixTermEnum. For each term I want the payload from I'm running this function: private String getPayload(Term term) { String payload = null; try { TermPositions termPositions = reader.termPositions(term); termPositions.next(); if (termPositions.isPayloadAvailable()) { byte[] payloadBytes = new byte[termPositions.getPayloadLength()]; payloadBytes = termPositions.getPayload(payloadBytes, 0); payload = new String(payloadBytes); LOG.debug(payload); } } catch( IOException e) { ... This never returns anything though. Am I missing something here? Any help would be greatly appreciated. Cheers, Derek -------------------------------------------------------------------------- NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers. If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.