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; |
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
<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
<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
{ | |
"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
<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
var isoCountries = { | |
'AF' : 'Afghanistan', | |
'AX' : 'Aland Islands', | |
'AL' : 'Albania', | |
'DZ' : 'Algeria', | |
'AS' : 'American Samoa', | |
'AD' : 'Andorra', | |
'AO' : 'Angola', | |
'AI' : 'Anguilla', | |
'AQ' : 'Antarctica', |
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
var countryToLanguages = { AD: [ 'ca' ], | |
AE: [ 'ar', 'fa', 'en', 'hi', 'ur' ], | |
AF: [ 'fa', 'ps', 'uz', 'tk' ], | |
AG: [ 'en' ], | |
AI: [ 'en' ], | |
AL: [ 'sq', 'el' ], | |
AM: [ 'hy' ], | |
AO: [ 'pt' ], | |
AR: [ 'es', 'en', 'it', 'de', 'fr', 'gn' ], | |
AS: [ 'en', 'sm', 'to' ], |
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
var config = { | |
"aws" : { | |
"bucket": "...", | |
"domain" : "...", | |
"prefix" : "..", | |
"path": "my/test/", | |
"credentials" : { | |
"accessKeyId": "...", | |
"secretAccessKey": "..." | |
} |
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
// what we're working with | |
var characterList = 'acdegilmnoprstuw'; | |
// what we're going for | |
var theHashWeWereLookingFor = 956446786872726; | |
var theMagicString = ''; | |
//Now reverse engineer | |
while (theHashWeWereLookingFor > 7 ) { | |
var counter = 0; |
OlderNewer