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
from datetime import date | |
s = str(1900630375204) | |
gender = int(s[0])==1 and 'M' or 'F' | |
born_date = date(1900+int(s[1:3]), int(s[3:5]), int(s[5:7])) | |
city_code = int(s[7:]) | |
print gender, borndate, city_code |
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
{ | |
"webapp_contents": { | |
"content": { | |
"dynamic_templates": [ | |
{ | |
"metadata_title": { | |
"mapping": { | |
"analyzer": "autocomplete" | |
}, |
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
from elasticsearch_dsl import query | |
q = {'bool': {'must': [{'term': {'customer_id_list': u'es_igames'}}], 'minimum_number_should_match': 1, 'should': [{'query_string': {'minimum_should_match': '30%', 'fields': [u'meta_es_igames.title^5', u'meta_es_igames.es.title^5', u'meta_es_igames.artist_name_list^3', u'meta_es_igames.author_name_list^3', u'meta_es_igames.album_name_list^2', u'meta_es_igames.es.abstract^2', u'meta_es_igames.es.description'], 'default_operator': 'OR', 'use_dis_max': False, 'query': u'debug'}}, [{'term': {u'meta_es_igames.es.title': u'debug'}}, {'prefix': {u'meta_es_igames.es.title': u'debug'}}, {'fuzzy': {u'meta_es_igames.es.title': u'debug'}}, {'term': {'publisher': u'debug'}}, {'prefix': {'publisher': u'debug'}}, {'fuzzy': {'publisher': u'debug'}}, {'term': {'cs_id': u'debug'}}]]}} | |
query.Q(q) |
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
>>> gencode = { | |
... 'ATA':'I', 'ATC':'I', 'ATT':'I', 'ATG':'M', | |
... 'ACA':'T', 'ACC':'T', 'ACG':'T', 'ACT':'T', | |
... 'AAC':'N', 'AAT':'N', 'AAA':'K', 'AAG':'K', | |
... 'AGC':'S', 'AGT':'S', 'AGA':'R', 'AGG':'R', | |
... 'CTA':'L', 'CTC':'L', 'CTG':'L', 'CTT':'L', | |
... 'CCA':'P', 'CCC':'P', 'CCG':'P', 'CCT':'P', | |
... 'CAC':'H', 'CAT':'H', 'CAA':'Q', 'CAG':'Q', | |
... 'CGA':'R', 'CGC':'R', 'CGG':'R', 'CGT':'R', | |
... 'GTA':'V', 'GTC':'V', 'GTG':'V', 'GTT':'V', |
NewerOlder