本文整理汇总了Python中addok.db.DB.hgetall方法的典型用法代码示例。如果您正苦于以下问题:Python DB.hgetall方法的具体用法?Python DB.hgetall怎么用?Python DB.hgetall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类addok.db.DB
的用法示例。
在下文中一共展示了DB.hgetall方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: deindex_document
# 需要导入模块: from addok.db import DB [as 别名]
# 或者: from addok.db.DB import hgetall [as 别名]
def deindex_document(id_, **kwargs):
key = keys.document_key(id_)
doc = DB.hgetall(key)
if not doc:
return
tokens = []
for indexer in config.DEINDEXERS:
indexer(DB, key, doc, tokens, **kwargs)
示例2: test_field_with_only_non_alphanumeric_chars_is_not_indexed
# 需要导入模块: from addok.db import DB [as 别名]
# 或者: from addok.db.DB import hgetall [as 别名]
def test_field_with_only_non_alphanumeric_chars_is_not_indexed():
doc = {
'id': 'xxxx',
'lat': '49.32545',
'lon': '4.2565',
'name': 'Lilas',
'city': '//'
}
index_document(doc)
assert 'city' not in DB.hgetall('d|xxxx')
示例3: test_null_value_should_not_be_index
# 需要导入模块: from addok.db import DB [as 别名]
# 或者: from addok.db.DB import hgetall [as 别名]
def test_null_value_should_not_be_index(config):
doc = {
'id': 'xxxx',
'lat': '49.32545',
'lon': '4.2565',
'name': 'Port-Cergy',
'city': ''
}
index_document(doc)
assert 'city' not in DB.hgetall('d|xxxx')
示例4: test_index_housenumber_uses_housenumber_preprocessors
# 需要导入模块: from addok.db import DB [as 别名]
# 或者: from addok.db.DB import hgetall [as 别名]
def test_index_housenumber_uses_housenumber_preprocessors(config):
doc = {
"id": "xxxx",
"type": "street",
"name": "rue des Lilas",
"city": "Paris",
"lat": "49.32545",
"lon": "4.2565",
"housenumbers": {"1 bis": {"lat": "48.325451", "lon": "2.25651"}},
}
index_document(doc)
index = DB.hgetall("d|xxxx")
assert index[b"h|1b"] == b"1 bis|48.325451|2.25651"
示例5: test_index_housenumber_uses_housenumber_preprocessors
# 需要导入模块: from addok.db import DB [as 别名]
# 或者: from addok.db.DB import hgetall [as 别名]
def test_index_housenumber_uses_housenumber_preprocessors():
# By default it glues ordinal to number
doc = {
'id': 'xxxx',
'type': 'street',
'name': 'rue des Lilas',
'city': 'Paris',
'lat': '49.32545',
'lon': '4.2565',
'housenumbers': {
'1 bis': {
'lat': '48.325451',
'lon': '2.25651'
}
}
}
index_document(doc)
index = DB.hgetall('d|xxxx')
assert index[b'h|1b'] == b'1 bis|48.325451|2.25651'
示例6: test_index_should_join_housenumbers_payload_fields
# 需要导入模块: from addok.db import DB [as 别名]
# 或者: from addok.db.DB import hgetall [as 别名]
def test_index_should_join_housenumbers_payload_fields(config):
config.HOUSENUMBERS_PAYLOAD_FIELDS = ['key', 'one']
doc = {
'id': 'xxxx',
'type': 'street',
'name': 'rue des Lilas',
'city': 'Paris',
'lat': '49.32545',
'lon': '4.2565',
'housenumbers': {
'1 bis': {
'lat': '48.325451',
'lon': '2.25651',
'key': 'myvalue',
'thisone': 'no',
'one': 'two',
}
}
}
index_document(doc)
index = DB.hgetall('d|xxxx')
assert index[b'h|1bis'] == b'1 bis|48.325451|2.25651|myvalue|two'