Skip to content

Commit

Permalink
exclude relayed txs if isRelayed=false
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan-rosianu committed Jan 17, 2025
1 parent 15d686b commit e58959a
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/common/indexer/elastic/elastic.indexer.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,14 @@ export class ElasticIndexerHelper {
elasticQuery = elasticQuery.withMustMatchCondition('relayerAddr', filter.relayer);
}

if (filter.isRelayed) {
elasticQuery = elasticQuery.withMustCondition(QueryType.Should([
QueryType.Match('isRelayed', filter.isRelayed),
QueryType.Exists('relayer'),
]));
const relayedConditions = QueryType.Should([
QueryType.Match('isRelayed', filter.isRelayed),
QueryType.Exists('relayer'),
]);
if (filter.isRelayed === true) {
elasticQuery = elasticQuery.withMustCondition(relayedConditions);
} else if (filter.isRelayed === false){
elasticQuery = elasticQuery.withMustNotCondition(relayedConditions);
}

if (filter.type) {
Expand Down Expand Up @@ -558,11 +561,14 @@ export class ElasticIndexerHelper {
elasticQuery = elasticQuery.withMustMatchCondition('tokens', filter.token, QueryOperator.AND);
}

if (filter.isRelayed) {
elasticQuery = elasticQuery.withMustCondition(QueryType.Should([
QueryType.Match('isRelayed', filter.isRelayed),
QueryType.Exists('relayer'),
]));
const relayedConditions = QueryType.Should([
QueryType.Match('isRelayed', filter.isRelayed),
QueryType.Exists('relayer'),
]);
if (filter.isRelayed === true) {
elasticQuery = elasticQuery.withMustCondition(relayedConditions);
} else if (filter.isRelayed === false){
elasticQuery = elasticQuery.withMustNotCondition(relayedConditions);
}

if (filter.relayer) {
Expand Down

0 comments on commit e58959a

Please sign in to comment.