From 18c86a8b22417681da55d3000f96bdc3c1d5a52e Mon Sep 17 00:00:00 2001 From: Bradnitski Viachaslau Date: Mon, 9 Oct 2023 11:08:51 +0300 Subject: [PATCH] add test for nested boolean DSL query #10272 (#10273) (cherry picked from commit 9001994d7d1825a870c5e5ed781f77626f8deaa6) --- .../factory/dsl/BooleanQueryBuilderTest.java | 7 +++++ .../dsl/boolean/query/mustNot_array.json | 22 +++++++++++++++ .../dsl/boolean/result/mustNot_array.json | 28 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 modules/core/core-repo/src/test/resources/com/enonic/xp/repo/impl/elasticsearch/query/translator/factory/dsl/boolean/query/mustNot_array.json create mode 100644 modules/core/core-repo/src/test/resources/com/enonic/xp/repo/impl/elasticsearch/query/translator/factory/dsl/boolean/result/mustNot_array.json diff --git a/modules/core/core-repo/src/test/java/com/enonic/xp/repo/impl/elasticsearch/query/translator/factory/dsl/BooleanQueryBuilderTest.java b/modules/core/core-repo/src/test/java/com/enonic/xp/repo/impl/elasticsearch/query/translator/factory/dsl/BooleanQueryBuilderTest.java index 0a3e6f386fb..59b6d74cb49 100644 --- a/modules/core/core-repo/src/test/java/com/enonic/xp/repo/impl/elasticsearch/query/translator/factory/dsl/BooleanQueryBuilderTest.java +++ b/modules/core/core-repo/src/test/java/com/enonic/xp/repo/impl/elasticsearch/query/translator/factory/dsl/BooleanQueryBuilderTest.java @@ -25,6 +25,13 @@ public void mustNot() test( "mustNot" ); } + @Test + public void mustNotArray() + throws Exception + { + test( "mustNot_array" ); + } + @Test public void should() throws Exception diff --git a/modules/core/core-repo/src/test/resources/com/enonic/xp/repo/impl/elasticsearch/query/translator/factory/dsl/boolean/query/mustNot_array.json b/modules/core/core-repo/src/test/resources/com/enonic/xp/repo/impl/elasticsearch/query/translator/factory/dsl/boolean/query/mustNot_array.json new file mode 100644 index 00000000000..ffbdb67bc29 --- /dev/null +++ b/modules/core/core-repo/src/test/resources/com/enonic/xp/repo/impl/elasticsearch/query/translator/factory/dsl/boolean/query/mustNot_array.json @@ -0,0 +1,22 @@ +{ + "boolean" : { + "mustNot" : [ + { + "boolean" : { + "should" : { + "fulltext" : { + "fields" : [ + "displayName" + ], + "query" : "fisk" + }, + "term" : { + "field" : "custom_number", + "value" : 2.4 + } + } + } + } + ] + } +} diff --git a/modules/core/core-repo/src/test/resources/com/enonic/xp/repo/impl/elasticsearch/query/translator/factory/dsl/boolean/result/mustNot_array.json b/modules/core/core-repo/src/test/resources/com/enonic/xp/repo/impl/elasticsearch/query/translator/factory/dsl/boolean/result/mustNot_array.json new file mode 100644 index 00000000000..64c661aa9ea --- /dev/null +++ b/modules/core/core-repo/src/test/resources/com/enonic/xp/repo/impl/elasticsearch/query/translator/factory/dsl/boolean/result/mustNot_array.json @@ -0,0 +1,28 @@ +{ + "bool" : { + "must_not" : { + "bool" : { + "should" : [ + { + "simple_query_string" : { + "query" : "fisk", + "fields" : [ + "displayname._analyzed" + ], + "analyzer" : "fulltext_search_default", + "analyze_wildcard" : true + } + }, + { + "term" : { + "custom_number._number" : { + "value" : 2.4, + "_name" : "custom_number._number" + } + } + } + ] + } + } + } +}