From e8278edf055a01b0fb36bff77b3c923d42ecb0e1 Mon Sep 17 00:00:00 2001 From: Bourne Shi Date: Thu, 17 Oct 2024 18:17:10 +0800 Subject: [PATCH] perf: optimize code --- .../Linq/GeneratorExpressionTreeVisitor.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/AElf.EntityMapping.Elasticsearch/Linq/GeneratorExpressionTreeVisitor.cs b/src/AElf.EntityMapping.Elasticsearch/Linq/GeneratorExpressionTreeVisitor.cs index 37dcd93..62e426c 100644 --- a/src/AElf.EntityMapping.Elasticsearch/Linq/GeneratorExpressionTreeVisitor.cs +++ b/src/AElf.EntityMapping.Elasticsearch/Linq/GeneratorExpressionTreeVisitor.cs @@ -313,14 +313,10 @@ private void HandleNestedContains(SubQueryExpression subQueryExpression, Express private Node GetDifferentTypesTermsQueryNode() { Node query; - if (PropertyType == typeof(Guid) || PropertyType == typeof(Guid)) + if (PropertyType == typeof(Guid) || PropertyType == typeof(Guid?)) { query = new TermsNode(PropertyName, ((IEnumerable)Value).Select(x => x.ToString())); } - else if (PropertyType == typeof(Guid?) || PropertyType == typeof(Guid?)) - { - query = new TermsNode(PropertyName, ((IEnumerable)Value).Select(x => x?.ToString())); - } else if (PropertyType == typeof(int) || PropertyType == typeof(int?)) { query = new TermsNode(PropertyName, ((IEnumerable)Value).Select(x => x.ToString())); @@ -336,7 +332,7 @@ private Node GetDifferentTypesTermsQueryNode() else if (PropertyType == typeof(DateTime) || PropertyType == typeof(DateTime?)) { query = new TermsNode(PropertyName, - ((IEnumerable)Value).Select(x => x.ToString("o"))); // ISO 8601 format + ((IEnumerable)Value).Select(x => x.ToString())); } else if (PropertyType == typeof(bool) || PropertyType == typeof(bool?)) {