forked from LBRYCommunity/lbry-sdk
Merge pull request #3078 from lbryio/null-language
support `none` argument to `any_languages` filter in `claim_search`
This commit is contained in:
commit
92b2ead74c
3 changed files with 5 additions and 3 deletions
|
@ -231,6 +231,7 @@ COMMON_TAGS = {
|
|||
}
|
||||
|
||||
INDEXED_LANGUAGES = [
|
||||
'none',
|
||||
'en',
|
||||
'aa',
|
||||
'ab',
|
||||
|
|
|
@ -330,7 +330,7 @@ class SQLDB:
|
|||
#self.logger.exception(f"Could not decode claim name for {tx.id}:{txo.position}.")
|
||||
continue
|
||||
|
||||
language = None
|
||||
language = 'none'
|
||||
try:
|
||||
if txo.claim.is_stream and txo.claim.stream.languages:
|
||||
language = txo.claim.stream.languages[0].language
|
||||
|
@ -394,8 +394,7 @@ class SQLDB:
|
|||
elif claim.is_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):
|
||||
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')
|
||||
|
||||
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, claim4, claim3], any_languages=['en', 'es'])
|
||||
await self.assertFindsClaims([], fee_currency='foo')
|
||||
|
|
Loading…
Reference in a new issue