lbry-sdk/lbry/wallet/server/db/elasticsearch/constants.py

88 lines
3.1 KiB
Python
Raw Normal View History

INDEX_DEFAULT_SETTINGS = {
"settings":
{"analysis":
{"analyzer": {
"default": {"tokenizer": "whitespace", "filter": ["lowercase", "porter_stem"]}}},
"index":
{"refresh_interval": -1,
"number_of_shards": 1,
"number_of_replicas": 0,
"sort": {
2021-08-17 03:59:20 +02:00
"field": ["trending_score", "release_time"],
"order": ["desc", "desc"]
}}
},
"mappings": {
"properties": {
"claim_id": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text",
"index_prefixes": {
"min_chars": 1,
"max_chars": 10
}
},
"height": {"type": "integer"},
"claim_type": {"type": "byte"},
"censor_type": {"type": "byte"},
2021-09-08 01:27:45 +02:00
"trending_score": {"type": "double"},
"release_time": {"type": "long"}
}
}
}
2021-07-21 15:10:29 +02:00
FIELDS = {
'_id',
'claim_id', 'claim_type', 'claim_name', 'normalized_name',
2021-07-21 15:10:29 +02:00
'tx_id', 'tx_nout', 'tx_position',
'short_url', 'canonical_url',
'is_controlling', 'last_take_over_height',
2021-07-21 17:30:05 +02:00
'public_key_bytes', 'public_key_id', 'claims_in_channel', 'channel_join_height',
2021-07-21 15:10:29 +02:00
'channel_id', 'signature', 'signature_digest', 'is_signature_valid',
'amount', 'effective_amount', 'support_amount',
'fee_amount', 'fee_currency',
'height', 'creation_height', 'activation_height', 'expiration_height',
'stream_type', 'media_type', 'censor_type',
'title', 'author', 'description',
'timestamp', 'creation_timestamp',
'duration', 'release_time',
2021-07-22 05:39:36 +02:00
'tags', 'languages', 'has_source', 'reposted_claim_type',
2021-07-21 17:30:05 +02:00
'reposted_claim_id', 'repost_count',
2021-09-08 17:58:00 +02:00
'trending_score', 'tx_num'
2021-07-21 15:10:29 +02:00
}
TEXT_FIELDS = {'author', 'canonical_url', 'channel_id', 'description', 'claim_id', 'censoring_channel_id',
'media_type', 'normalized_name', 'public_key_bytes', 'public_key_id', 'short_url', 'signature',
'claim_name', 'signature_digest', 'title', 'tx_id', 'fee_currency', 'reposted_claim_id',
'tags'}
2021-07-21 15:10:29 +02:00
RANGE_FIELDS = {
'height', 'creation_height', 'activation_height', 'expiration_height',
'timestamp', 'creation_timestamp', 'duration', 'release_time', 'fee_amount',
2021-07-21 17:30:05 +02:00
'tx_position', 'channel_join', 'repost_count', 'limit_claims_per_channel',
'amount', 'effective_amount', 'support_amount',
2021-09-09 20:18:08 +02:00
'trending_score', 'censor_type', 'tx_num'
}
2021-07-21 15:10:29 +02:00
2021-07-20 23:09:39 +02:00
ALL_FIELDS = RANGE_FIELDS | TEXT_FIELDS | FIELDS
2021-07-21 15:10:29 +02:00
REPLACEMENTS = {
'claim_name': 'normalized_name',
'name': 'normalized_name',
'txid': 'tx_id',
2021-08-13 23:36:08 +02:00
'nout': 'tx_nout',
'trending_group': 'trending_score',
2021-09-13 16:50:02 +02:00
'trending_mixed': 'trending_score',
'trending_global': 'trending_score',
'trending_local': 'trending_score',
2021-09-13 16:50:02 +02:00
'reposted': 'repost_count',
2021-09-13 17:56:44 +02:00
'stream_types': 'stream_type',
'media_types': 'media_type',
2021-09-13 16:50:02 +02:00
'valid_channel_signature': 'is_signature_valid'
}