diff --git a/lbry/wallet/server/db/elastic_search.py b/lbry/wallet/server/db/elastic_search.py index fcbd33f0e..7ad5b9ead 100644 --- a/lbry/wallet/server/db/elastic_search.py +++ b/lbry/wallet/server/db/elastic_search.py @@ -236,11 +236,10 @@ class SearchIndex: async def search(self, **kwargs): if 'channel' in kwargs: - results, _, _ = await self.resolve(kwargs.pop('channel')) - if not results or not isinstance(results, Iterable): + channel_id = await self.resolve_url(kwargs.pop('channel')) + if not channel_id or not isinstance(channel_id, str): return [], 0, 0 - result = results[0] if results else None - kwargs['channel_id'] = result['claim_id'] + kwargs['channel_id'] = channel_id try: result = await self.search_client.search( expand_query(**kwargs), index=self.index, track_total_hits=200 diff --git a/tests/integration/blockchain/test_claim_commands.py b/tests/integration/blockchain/test_claim_commands.py index 93ffbfe79..02ca8a02a 100644 --- a/tests/integration/blockchain/test_claim_commands.py +++ b/tests/integration/blockchain/test_claim_commands.py @@ -150,6 +150,7 @@ class ClaimSearchCommand(ClaimTestCase): claims = [three, two, signed] await self.assertFindsClaims(claims, channel_ids=[self.channel_id]) await self.assertFindsClaims(claims, channel=f"@abc#{self.channel_id}") + await self.assertFindsClaims([], channel=f"@inexistent") await self.assertFindsClaims([three, two, signed2, signed], channel_ids=[channel_id2, self.channel_id]) await self.channel_abandon(claim_id=self.channel_id) await self.assertFindsClaims([], channel=f"@abc#{self.channel_id}", valid_channel_signature=True)