Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.EsTable;

import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;

import java.util.Iterator;
Expand Down Expand Up @@ -156,6 +157,9 @@ private void resolveDocValuesFields(SearchContext searchContext, JSONObject fiel
}
docValueField = colName;
}
searchContext.docValueFieldsContext().put(colName, docValueField);
// docValueField Cannot be null
if (StringUtils.isNotEmpty(docValueField)) {
searchContext.docValueFieldsContext().put(colName, docValueField);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import mockit.Injectable;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

public class MappingPhaseTest extends EsTestCase {

Expand Down Expand Up @@ -102,4 +103,14 @@ public void testWorkFlow(@Injectable EsRestClient client) throws Exception{
assertEquals("k2", searchContext1.docValueFieldsContext().get("k2"));

}
}

@Test
public void testMultTextFields() 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"));

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"test": {
"mappings": {
"properties": {
"k1": {
"type": "long"
},
"k2": {
"type": "keyword"
},
"k3": {
"type": "text",
"fields": {
"ik": {
"type": "text",
"analyzer": "ik_max_word"
}
}
}
}
}
}
}