Skip to content

Commit

Permalink
feat: optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
AElfBourneShi committed Oct 16, 2024
1 parent a157a53 commit 333a6c3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ public ElasticsearchClientProvider(IOptions<ElasticsearchOptions> options)
{
var uris = options.Value.Uris.ConvertAll(x => new Uri(x));
var connectionPool = new StaticConnectionPool(uris);
var settings = new ConnectionSettings(connectionPool)
.DisableDirectStreaming()
.OnRequestCompleted(callDetails =>
{
// Print Request DSL
if (callDetails.RequestBodyInBytes != null)
{
Console.WriteLine($"Request JSON: {Encoding.UTF8.GetString(callDetails.RequestBodyInBytes)}");
}
// // Print Response Data
// if (callDetails.ResponseBodyInBytes != null)
// {
// Console.WriteLine($"Response JSON: {Encoding.UTF8.GetString(callDetails.ResponseBodyInBytes)}");
// }
});
var settings = new ConnectionSettings(connectionPool);
// .DisableDirectStreaming()
// .OnRequestCompleted(callDetails =>
// {
// // Print Request DSL
// if (callDetails.RequestBodyInBytes != null)
// {
// Console.WriteLine($"Request JSON: {Encoding.UTF8.GetString(callDetails.RequestBodyInBytes)}");
// }
// // // Print Response Data
// // if (callDetails.ResponseBodyInBytes != null)
// // {
// // Console.WriteLine($"Response JSON: {Encoding.UTF8.GetString(callDetails.ResponseBodyInBytes)}");
// // }
// });
_elasticClient = new ElasticClient(settings);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ protected override Expression VisitSubQuery(SubQueryExpression expression)
{
if (whereClause.Predicate is SubQueryExpression subQueryExpression)
{
var parentPropertyName = PropertyName.Clone().ToString();
HandleNestedContains(subQueryExpression, expression, from,
fullPath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ public async Task GetNestedList_Terms_Test()
.Select(s => (Expression<Func<TransactionIndex, bool>>)(info => info.LogEvents.Any(x => x.BlockHeight == s)))
.Aggregate((prev, next) => prev.Or(next));
var filterList_predicate = queryable_predicate.Where(predicates).ToList();
filterList_predicate.Count.ShouldBe(2);

Expression<Func<TransactionIndex, bool>> mustQuery = item =>
item.LogEvents.Any(x => inputs.Contains(x.BlockHeight));
Expand Down

0 comments on commit 333a6c3

Please sign in to comment.