apply filtering only to whats unfiltered

This commit is contained in:
Victor Shyba 2021-01-29 04:14:42 -03:00
parent 9989d8d1d4
commit 9a9df2fc3c

View file

@ -83,9 +83,9 @@ class SearchIndex:
blockdict = dict( blockdict = dict(
(hexlify(key[::-1]).decode(), hexlify(value[::-1]).decode()) for key, value in blockdict.items()) (hexlify(key[::-1]).decode(), hexlify(value[::-1]).decode()) for key, value in blockdict.items())
if channels: if channels:
update = expand_query(channel_id__in=list(blockdict.keys())) update = expand_query(channel_id__in=list(blockdict.keys()), censor_type=f"<{censor_type}")
else: else:
update = expand_query(claim_id__in=list(blockdict.keys())) update = expand_query(claim_id__in=list(blockdict.keys()), censor_type=f"<{censor_type}")
key = 'channel_id' if channels else 'claim_id' key = 'channel_id' if channels else 'claim_id'
update['script'] = { update['script'] = {
"source": f"ctx._source.censor_type={censor_type}; ctx._source.censoring_channel_hash=params[ctx._source.{key}]", "source": f"ctx._source.censor_type={censor_type}; ctx._source.censoring_channel_hash=params[ctx._source.{key}]",
@ -264,7 +264,7 @@ FIELDS = ['is_controlling', 'last_take_over_height', 'claim_id', 'claim_name', '
TEXT_FIELDS = ['author', 'canonical_url', 'channel_id', 'claim_name', 'description', TEXT_FIELDS = ['author', 'canonical_url', 'channel_id', 'claim_name', 'description',
'media_type', 'normalized', 'public_key_bytes', 'public_key_hash', 'short_url', 'signature', 'media_type', 'normalized', 'public_key_bytes', 'public_key_hash', 'short_url', 'signature',
'signature_digest', 'stream_type', 'title', 'tx_id', 'fee_currency', 'reposted_claim_id', 'tags'] 'signature_digest', 'stream_type', 'title', 'tx_id', 'fee_currency', 'reposted_claim_id', 'tags']
RANGE_FIELDS = ['height', 'fee_amount', 'duration', 'reposted', 'release_time'] RANGE_FIELDS = ['height', 'fee_amount', 'duration', 'reposted', 'release_time', 'censor_type']
REPLACEMENTS = { REPLACEMENTS = {
'name': 'normalized', 'name': 'normalized',
'txid': 'tx_id', 'txid': 'tx_id',