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
<add> | |
<doc> | |
<field name="id">1</field> | |
<field name="title">Doc one</field> | |
<field name="payloads">testone|10.4 testtwo|30.2 testthree|5.6</field> | |
<field name="text">I testone, you testtwo, they testthree</field> | |
</doc> | |
<doc> | |
<field name="id">2</field> | |
<field name="title">Doc two</field> |
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
{ | |
"responseHeader":{ | |
"status":0, | |
"QTime":2}, | |
"response":{"numFound":4,"start":0,"docs":[ | |
{ | |
"id":"1", | |
"title":["Doc one"], | |
"payloads":"testone|10.4 testtwo|30.2 testthree|5.6", | |
"_version_":1457289004134170624}, |
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
<lib path="../../lib/solr-payloads-plugin.jar"/> | |
<!-- Request Handler to do payload queries --> | |
<queryParser name="payloadQueryParser" class="com.custom.solr.PayloadQParserPlugin"/> | |
<requestHandler name="/pds-search" class="solr.SearchHandler"> | |
<lst name="defaults"> | |
<str name="defType">payloadQueryParser</str> | |
</lst> | |
</requestHandler> |
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
<similarity class="com.custom.solr.CustomSolrSimilarity" /> |
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
import org.apache.lucene.analysis.payloads.PayloadHelper; | |
import org.apache.lucene.search.similarities.DefaultSimilarity; | |
import org.apache.lucene.util.BytesRef; | |
public class CustomSolrSimilarity extends DefaultSimilarity { | |
@Override | |
public float scorePayload(int doc, int start, int end, BytesRef payload) { | |
if (payload != null) { | |
return PayloadHelper.decodeFloat(payload.bytes);; |
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
import org.apache.commons.lang.StringUtils; | |
import org.apache.lucene.index.Term; | |
import org.apache.lucene.search.BooleanQuery; | |
import org.apache.lucene.search.Query; | |
import org.apache.lucene.search.BooleanClause.Occur; | |
import org.apache.lucene.search.payloads.AveragePayloadFunction; | |
import org.apache.lucene.search.payloads.PayloadTermQuery; | |
import org.apache.solr.common.params.SolrParams; | |
import org.apache.solr.common.util.NamedList; | |
import org.apache.solr.request.SolrQueryRequest; |
NewerOlder