Created
September 3, 2010 08:44
-
-
Save jnioche/563623 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.digitalpebble.solr; | |
import org.apache.lucene.analysis.payloads.PayloadHelper; | |
import org.apache.lucene.search.DefaultSimilarity; | |
public class PayloadSimilarity extends DefaultSimilarity | |
{ | |
@Override public float scorePayload(int docId, String fieldName, int start, int end, byte[] payload, int offset, int length) | |
{ | |
if (length > 0) { | |
return PayloadHelper.decodeFloat(payload, offset); | |
} | |
return 1.0f; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment