This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 3a1c8e7b15d [opt](inverted index) set support_phrase default true if 
parser is set #37947 (#38029)
3a1c8e7b15d is described below

commit 3a1c8e7b15d4f987e7dbc3a3711b017048325611
Author: zzzxl <33418555+zzzxl1...@users.noreply.github.com>
AuthorDate: Thu Jul 18 17:02:32 2024 +0800

    [opt](inverted index) set support_phrase default true if parser is set 
#37947 (#38029)
---
 .../src/main/java/org/apache/doris/catalog/Index.java       | 13 ++++++++++---
 .../org/apache/doris/common/proc/IndexesProcNodeTest.java   |  2 +-
 regression-test/suites/index_p0/test_index_meta.groovy      | 10 +++++-----
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Index.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Index.java
index 24abe49095f..41c11d2d987 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Index.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Index.java
@@ -71,9 +71,16 @@ public class Index implements Writable {
         this.comment = comment;
         if (indexType == IndexDef.IndexType.INVERTED) {
             if (this.properties != null && !this.properties.isEmpty()) {
-                String key = 
InvertedIndexUtil.INVERTED_INDEX_PARSER_LOWERCASE_KEY;
-                if (!properties.containsKey(key)) {
-                    this.properties.put(key, "true");
+                if 
(this.properties.containsKey(InvertedIndexUtil.INVERTED_INDEX_PARSER_KEY)) {
+                    String lowerCaseKey = 
InvertedIndexUtil.INVERTED_INDEX_PARSER_LOWERCASE_KEY;
+                    if (!properties.containsKey(lowerCaseKey)) {
+                        this.properties.put(lowerCaseKey, "true");
+                    }
+                    String supportPhraseKey = InvertedIndexUtil
+                            .INVERTED_INDEX_SUPPORT_PHRASE_KEY;
+                    if (!properties.containsKey(supportPhraseKey)) {
+                        this.properties.put(supportPhraseKey, "true");
+                    }
                 }
             }
         }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/common/proc/IndexesProcNodeTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/common/proc/IndexesProcNodeTest.java
index b2787cc7056..aeb5bc471fe 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/common/proc/IndexesProcNodeTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/common/proc/IndexesProcNodeTest.java
@@ -80,7 +80,7 @@ public class IndexesProcNodeTest {
         Assert.assertEquals(procResult.getRows().get(1).get(5), "col_2");
         Assert.assertEquals(procResult.getRows().get(1).get(11), "INVERTED");
         Assert.assertEquals(procResult.getRows().get(1).get(12), "inverted 
index on col_2");
-        Assert.assertEquals(procResult.getRows().get(1).get(13), "(\"parser\" 
= \"unicode\", \"lower_case\" = \"true\")");
+        Assert.assertEquals(procResult.getRows().get(1).get(13), "(\"parser\" 
= \"unicode\", \"lower_case\" = \"true\", \"support_phrase\" = \"true\")");
 
         Assert.assertEquals(procResult.getRows().get(2).get(0), 
"tbl_test_indexes_proc");
         Assert.assertEquals(procResult.getRows().get(2).get(1), "3");
diff --git a/regression-test/suites/index_p0/test_index_meta.groovy 
b/regression-test/suites/index_p0/test_index_meta.groovy
index 577f18678cd..b38206e7e21 100644
--- a/regression-test/suites/index_p0/test_index_meta.groovy
+++ b/regression-test/suites/index_p0/test_index_meta.groovy
@@ -71,7 +71,7 @@ suite("index_meta", "p0") {
     assertEquals(show_result[1][4], "name")
     assertEquals(show_result[1][10], "INVERTED")
     assertEquals(show_result[1][11], "index for name")
-    assertEquals(show_result[1][12], "(\"parser\" = \"none\", \"lower_case\" = 
\"true\")")
+    assertEquals(show_result[1][12], "(\"parser\" = \"none\", \"lower_case\" = 
\"true\", \"support_phrase\" = \"true\")")
 
     // add index on column description
     sql "create index idx_desc on ${tableName}(description) USING INVERTED 
PROPERTIES(\"parser\"=\"standard\") COMMENT 'index for description';"
@@ -90,12 +90,12 @@ suite("index_meta", "p0") {
     assertEquals(show_result[1][4], "name")
     assertEquals(show_result[1][10], "INVERTED")
     assertEquals(show_result[1][11], "index for name")
-    assertEquals(show_result[1][12], "(\"parser\" = \"none\", \"lower_case\" = 
\"true\")")
+    assertEquals(show_result[1][12], "(\"parser\" = \"none\", \"lower_case\" = 
\"true\", \"support_phrase\" = \"true\")")
     assertEquals(show_result[2][2], "idx_desc")
     assertEquals(show_result[2][4], "description")
     assertEquals(show_result[2][10], "INVERTED")
     assertEquals(show_result[2][11], "index for description")
-    assertEquals(show_result[2][12], "(\"parser\" = \"standard\", 
\"lower_case\" = \"true\")")
+    assertEquals(show_result[2][12], "(\"parser\" = \"standard\", 
\"lower_case\" = \"true\", \"support_phrase\" = \"true\")")
 
     // drop index
     // add index on column description
@@ -114,7 +114,7 @@ suite("index_meta", "p0") {
     assertEquals(show_result[1][4], "description")
     assertEquals(show_result[1][10], "INVERTED")
     assertEquals(show_result[1][11], "index for description")
-    assertEquals(show_result[1][12], "(\"parser\" = \"standard\", 
\"lower_case\" = \"true\")")
+    assertEquals(show_result[1][12], "(\"parser\" = \"standard\", 
\"lower_case\" = \"true\", \"support_phrase\" = \"true\")")
 
     // add index on column description
     sql "create index idx_name on ${tableName}(name) USING INVERTED COMMENT 
'new index for name';"
@@ -133,7 +133,7 @@ suite("index_meta", "p0") {
     assertEquals(show_result[1][4], "description")
     assertEquals(show_result[1][10], "INVERTED")
     assertEquals(show_result[1][11], "index for description")
-    assertEquals(show_result[1][12], "(\"parser\" = \"standard\", 
\"lower_case\" = \"true\")")
+    assertEquals(show_result[1][12], "(\"parser\" = \"standard\", 
\"lower_case\" = \"true\", \"support_phrase\" = \"true\")")
     assertEquals(show_result[2][2], "idx_name")
     assertEquals(show_result[2][4], "name")
     assertEquals(show_result[2][10], "INVERTED")


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to