Yes, that is definitely the case, but I think Tricia was more getting at how to use them for display, i.e deserializing them into a String or whatever. I still have on my plate that I want to figure out how to incorporate payloads with SpanQuery as that is the logical means of getting at them query wise.

-Grant

On Apr 5, 2008, at 4:51 AM, Mike Klaas wrote:

On 3-Apr-08, at 3:58 PM, Tricia Williams wrote:
Hi,

I think that displaying the payload (if one exists) of each token in the analysis.jsp would be beneficial. My simple solution was to add a row to the existing table, convert the Payload byte array to a String and simple print the results. I opened SOLR-522 to this effect. There is a PayloadHelper class in Lucene that has decode/encode float and int methods. Any ideas on how Payloads might be uniformly decoded into something readable/debugable from the gui? I think bytes to String will give enough of a clue to be helpful.

Similarity.scorePayload(), if defined, should be the commonly-used method (at least, that's what I do):

 public float scorePayload(byte [] payload, int offset, int length) {
   assert length == 4;
   int accum = ((payload[0+offset]&0xff)) |
               ((payload[1+offset]&0xff)<<8) |
               ((payload[2+offset]&0xff)<<16)  |
               ((payload[3+offset]&0xff)<<24);

   return Float.intBitsToFloat(accum);
}

-Mike

Reply via email to