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

83 lines
3 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": {
"field": ["trending_mixed", "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"},
"trending_mixed": {"type": "float"},
"release_time": {"type": "long"},
}
}
}
2021-07-21 15:10:29 +02:00
FIELDS = {
'_id',
'claim_id', 'claim_type', 'claim_name', 'normalized_name',
'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',
'trending_group', 'trending_mixed', 'trending_local', 'trending_global', 'tx_num'
2021-07-21 15:10:29 +02:00
}
2021-07-20 23:25:37 +02:00
TEXT_FIELDS = {'author', 'canonical_url', 'channel_id', 'claim_name', 'description', 'claim_id', 'censoring_channel_id',
2021-07-21 15:10:29 +02:00
'media_type', 'normalized_name', 'public_key_bytes', 'public_key_id', 'short_url', 'signature',
2021-09-02 03:43:57 +02:00
'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',
'trending_group', 'trending_mixed', 'censor_type',
'trending_local', 'trending_global', '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 = {
2021-07-21 15:10:29 +02:00
'name': 'normalized_name',
'txid': 'tx_id',
2021-08-13 23:36:08 +02:00
'nout': 'tx_nout',
2021-08-14 00:58:58 +02:00
'valid_channel_signature': 'is_signature_valid',
'stream_types': 'stream_type',
'media_types': 'media_type',
'reposted': 'repost_count'
}