fix join, refresh before update

This commit is contained in:
Victor Shyba 2021-01-31 01:25:12 -03:00
parent 0f2a85ba9f
commit 8e68ba4751
2 changed files with 3 additions and 2 deletions

View file

@ -135,6 +135,7 @@ class SearchIndex:
"source": "ctx._source.signature_valid=false",
"lang": "painless"
}
await self.client.indices.refresh(self.index)
await self.client.update_by_query(self.index, body=update)
async def session_query(self, query_name, function, kwargs):

View file

@ -813,8 +813,8 @@ class SQLDB:
(select group_concat(tag, ',,') from tag where tag.claim_hash in (claim.claim_hash, claim.reposted_claim_hash)) as tags,
(select group_concat(language, ' ') from language where language.claim_hash in (claim.claim_hash, claim.reposted_claim_hash)) as languages,
claim.*
FROM claim LEFT JOIN claimtrie USING (claim_hash) LEFT JOIN support USING (claim_hash)
WHERE support.height = {height} OR claim.height = {height}
FROM claim LEFT JOIN claimtrie USING (claim_hash)
WHERE claim.height = {height} OR claim.claim_hash in (SELECT claim_hash FROM support WHERE height = {height})
"""):
claim = claim._asdict()
id_set = set(filter(None, (claim['claim_hash'], claim['channel_hash'], claim['reposted_claim_hash'])))