wuyunfeng commented on a change in pull request #4300:
URL: https://github.com/apache/incubator-doris/pull/4300#discussion_r467699429



##########
File path: 
fe/fe-core/src/test/java/org/apache/doris/external/elasticsearch/MappingPhaseTest.java
##########
@@ -102,4 +103,13 @@ public void testWorkFlow(@Injectable EsRestClient client) 
throws Exception{
         assertEquals("k2", searchContext1.docValueFieldsContext().get("k2"));
 
     }
+
+    @Test
+    public void testFieldMultAnalyzer() throws Exception {

Review comment:
       ```suggestion
       public void testMultTextFields() throws Exception {
   ```

##########
File path: 
fe/fe-core/src/test/java/org/apache/doris/external/elasticsearch/MappingPhaseTest.java
##########
@@ -102,4 +103,13 @@ public void testWorkFlow(@Injectable EsRestClient client) 
throws Exception{
         assertEquals("k2", searchContext1.docValueFieldsContext().get("k2"));
 
     }
+
+    @Test
+    public void testFieldMultAnalyzer() throws Exception {
+        MappingPhase mappingPhase = new MappingPhase(null);
+        EsTable esTableAfter7X = fakeEsTable("fake", "test", "_doc", columns);
+        SearchContext searchContext = new SearchContext(esTableAfter7X);
+        mappingPhase.resolveFields(searchContext, 
loadJsonFromFile("data/es/test_index_mapping_field_mult_analyzer.json"));
+        assertFalse(searchContext.docValueFieldsContext().containsKey("k3"));
+    }
 }

Review comment:
       add blank new line

##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/MappingPhase.java
##########
@@ -17,6 +17,7 @@
 
 package org.apache.doris.external.elasticsearch;
 
+import org.apache.commons.lang3.StringUtils;

Review comment:
       import order is not right

##########
File path: 
fe/fe-core/src/test/resources/data/es/test_index_mapping_field_mult_analyzer.json
##########
@@ -0,0 +1,23 @@
+{
+  "test": {
+    "mappings": {
+      "properties": {
+        "k1": {
+          "type": "long"
+        },
+        "k2": {
+          "type": "keyword"
+        },
+        "k3": {
+          "type": "text",
+          "fields": {
+            "ik": {
+              "type": "text",
+              "analyzer": "ik_max_word"
+            }
+          }
+        }
+      }
+    }
+  }
+}

Review comment:
       add blank new line

##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/MappingPhase.java
##########
@@ -156,6 +157,8 @@ private void resolveDocValuesFields(SearchContext 
searchContext, JSONObject fiel
             }
             docValueField = colName;
         }
-        searchContext.docValueFieldsContext().put(colName, docValueField);
+        if (StringUtils.isNotEmpty(docValueField)) {

Review comment:
       Can you add some comments for what you resolved




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to