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

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


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

commit b16cd30a20e6f73c907c47de495c27f656692f7d
Author: zzzxl <33418555+zzzxl1...@users.noreply.github.com>
AuthorDate: Thu Jul 18 08:07:16 2024 +0800

    [opt](inverted index) set support_phrase default true if parser is set 
(#38028)
    
    ## Proposed changes
    
    https://github.com/apache/doris/pull/37949
    
    <!--Describe your changes.-->
---
 .../src/main/java/org/apache/doris/catalog/Index.java       | 13 ++++++++++---
 .../org/apache/doris/common/proc/IndexesProcNodeTest.java   |  2 +-
 .../test_backup_restore_inverted_index.groovy               |  2 +-
 regression-test/suites/index_p0/test_index_meta.groovy      | 10 +++++-----
 4 files changed, 17 insertions(+), 10 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 6ead50192dd..a251b50673a 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
@@ -73,9 +73,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/backup_restore/test_backup_restore_inverted_index.groovy
 
b/regression-test/suites/backup_restore/test_backup_restore_inverted_index.groovy
index 7c4f04cbd2b..4e99b42654c 100644
--- 
a/regression-test/suites/backup_restore/test_backup_restore_inverted_index.groovy
+++ 
b/regression-test/suites/backup_restore/test_backup_restore_inverted_index.groovy
@@ -74,7 +74,7 @@ suite("test_backup_restore_inverted_index", "backup_restore") 
{
 
     def restore_index_comment = sql "SHOW CREATE TABLE ${dbName}.${tableName}"
 
-    assertTrue(restore_index_comment[0][1].contains("USING INVERTED 
PROPERTIES(\"parser\" = \"english\", \"lower_case\" = \"true\")"))
+    assertTrue(restore_index_comment[0][1].contains("USING INVERTED 
PROPERTIES(\"parser\" = \"english\", \"lower_case\" = \"true\", 
\"support_phrase\" = \"true\")"))
 
     result = sql "SELECT id, TOKENIZE(comment,'\"parser\"=\"english\"') as 
token FROM ${dbName}.${tableName}"
     assertEquals(result.size(), 2)
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