Skip to content

Commit

Permalink
only repeat search if it has blocked items
Browse files Browse the repository at this point in the history
  • Loading branch information
shyba committed Feb 1, 2021
1 parent 923a05f commit ee555ad
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lbry/wallet/server/db/elastic_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,12 @@ async def session_query(self, query_name, function, kwargs):
total_referenced, response, censor = await self.resolve(*kwargs)
else:
censor = Censor(Censor.SEARCH)
response, offset, total = await self.search(**kwargs, censor_type=0)
response, offset, total = await self.search(**kwargs)
censor.apply(response)
total_referenced.extend(response)
kwargs['limit'] = 20
kwargs['offset'] = 0
censored_response, _, _ = await self.search(**kwargs, censor_type='>0')
censor.apply(censored_response)
total_referenced.extend(censored_response)
if censor.censored:
response, _, _ = await self.search(**kwargs, censor_type=0)
total_referenced.extend(response)
return Outputs.to_base64(response, await self._get_referenced_rows(total_referenced), offset, total, censor)

async def resolve(self, *urls):
Expand Down

0 comments on commit ee555ad

Please sign in to comment.