hub changes for stream/repost with extensions #113
2 changed files with 8 additions and 7 deletions
|
@ -797,7 +797,7 @@ FIELDS = {
|
||||||
'reposted_claim_id', 'repost_count', 'sd_hash',
|
'reposted_claim_id', 'repost_count', 'sd_hash',
|
||||||
'trending_score', 'tx_num',
|
'trending_score', 'tx_num',
|
||||||
'channel_tx_id', 'channel_tx_position', 'channel_height', 'reposted_tx_id',
|
'channel_tx_id', 'channel_tx_position', 'channel_height', 'reposted_tx_id',
|
||||||
'reposted_tx_position', 'reposted_height', 'extensions', 'extensions_obj'
|
'reposted_tx_position', 'reposted_height', 'extensions',
|
||||||
}
|
}
|
||||||
|
|
||||||
TEXT_FIELDS = {
|
TEXT_FIELDS = {
|
||||||
|
@ -820,7 +820,8 @@ OBJECT_FIELDS = {
|
||||||
'extensions',
|
'extensions',
|
||||||
}
|
}
|
||||||
|
|
||||||
ALL_FIELDS = OBJECT_FIELDS | RANGE_FIELDS | TEXT_FIELDS | FIELDS
|
ALL_FIELDS = (RANGE_FIELDS | TEXT_FIELDS | FIELDS |
|
||||||
|
OBJECT_FIELDS | { f+'_obj' for f in OBJECT_FIELDS })
|
||||||
|
|
||||||
REPLACEMENTS = {
|
REPLACEMENTS = {
|
||||||
'claim_name': 'normalized_name',
|
'claim_name': 'normalized_name',
|
||||||
|
|
|
@ -205,13 +205,13 @@ class ElasticSyncService(BlockchainReaderService):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _upsert_claim_query(index, claim):
|
def _upsert_claim_query(index, claim):
|
||||||
doc = {key: value for key, value in claim.items() if key in ALL_FIELDS}
|
return {
|
||||||
doc.update({
|
'doc': {key: value for key, value in claim.items() if key in ALL_FIELDS},
|
||||||
'_id': claim['claim_id'],
|
'_id': claim['claim_id'],
|
||||||
'_index': index,
|
'_index': index,
|
||||||
'_op_type': 'index',
|
'_op_type': 'update',
|
||||||
})
|
'doc_as_upsert': True
|
||||||
return doc
|
}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _delete_claim_query(index, claim_hash: bytes):
|
def _delete_claim_query(index, claim_hash: bytes):
|
||||||
|
|
Loading…
Reference in a new issue