forked from LBRYCommunity/lbry-sdk
null language filtering for claim search
This commit is contained in:
parent
73d07311db
commit
bbed9b94c1
3 changed files with 5 additions and 3 deletions
|
@ -231,6 +231,7 @@ COMMON_TAGS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
INDEXED_LANGUAGES = [
|
INDEXED_LANGUAGES = [
|
||||||
|
'none',
|
||||||
'en',
|
'en',
|
||||||
'aa',
|
'aa',
|
||||||
'ab',
|
'ab',
|
||||||
|
|
|
@ -330,7 +330,7 @@ class SQLDB:
|
||||||
#self.logger.exception(f"Could not decode claim name for {tx.id}:{txo.position}.")
|
#self.logger.exception(f"Could not decode claim name for {tx.id}:{txo.position}.")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
language = None
|
language = 'none'
|
||||||
try:
|
try:
|
||||||
if txo.claim.is_stream and txo.claim.stream.languages:
|
if txo.claim.is_stream and txo.claim.stream.languages:
|
||||||
language = txo.claim.stream.languages[0].language
|
language = txo.claim.stream.languages[0].language
|
||||||
|
@ -394,8 +394,7 @@ class SQLDB:
|
||||||
elif claim.is_channel:
|
elif claim.is_channel:
|
||||||
claim_record['claim_type'] = CLAIM_TYPES['channel']
|
claim_record['claim_type'] = CLAIM_TYPES['channel']
|
||||||
|
|
||||||
if language:
|
languages[(language, claim_hash)] = (language, claim_hash, tx.height)
|
||||||
languages[(language, claim_hash)] = (language, claim_hash, tx.height)
|
|
||||||
|
|
||||||
for tag in clean_tags(claim.message.tags):
|
for tag in clean_tags(claim.message.tags):
|
||||||
tags[(tag, claim_hash)] = (tag, claim_hash, tx.height)
|
tags[(tag, claim_hash)] = (tag, claim_hash, tx.height)
|
||||||
|
|
|
@ -271,6 +271,8 @@ class ClaimSearchCommand(ClaimTestCase):
|
||||||
claim5 = await self.stream_create('claim5', fee_amount='1.0', fee_currency='usd', languages='es')
|
claim5 = await self.stream_create('claim5', fee_amount='1.0', fee_currency='usd', languages='es')
|
||||||
|
|
||||||
await self.assertFindsClaims([claim4, claim3], any_languages=['en'])
|
await self.assertFindsClaims([claim4, claim3], any_languages=['en'])
|
||||||
|
await self.assertFindsClaims([claim2, claim1], any_languages=['none'])
|
||||||
|
await self.assertFindsClaims([claim4, claim3, claim2, claim1], any_languages=['none', 'en'])
|
||||||
await self.assertFindsClaims([claim5], any_languages=['es'])
|
await self.assertFindsClaims([claim5], any_languages=['es'])
|
||||||
await self.assertFindsClaims([claim5, claim4, claim3], any_languages=['en', 'es'])
|
await self.assertFindsClaims([claim5, claim4, claim3], any_languages=['en', 'es'])
|
||||||
await self.assertFindsClaims([], fee_currency='foo')
|
await self.assertFindsClaims([], fee_currency='foo')
|
||||||
|
|
Loading…
Reference in a new issue