MCPcopy Create free account
hub / github.com/blevesearch/bleve / TestClosestDocDynamicMapping

Function TestClosestDocDynamicMapping

mapping/mapping_test.go:1091–1112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1089}
1090
1091func TestClosestDocDynamicMapping(t *testing.T) {
1092 mapping := NewIndexMapping()
1093 mapping.IndexDynamic = false
1094 mapping.DefaultMapping = NewDocumentStaticMapping()
1095 mapping.DefaultMapping.AddFieldMappingsAt("foo", NewTextFieldMapping())
1096
1097 doc := document.NewDocument("x")
1098 err := mapping.MapDocument(doc, map[string]interface{}{
1099 "foo": "value",
1100 "bar": map[string]string{
1101 "foo": "value2",
1102 "baz": "value3",
1103 },
1104 })
1105 if err != nil {
1106 t.Fatal(err)
1107 }
1108
1109 if len(doc.Fields) != 1 {
1110 t.Fatalf("expected 1 field, got: %d", len(doc.Fields))
1111 }
1112}
1113
1114func TestMappingPointerToTimeBug1152(t *testing.T) {
1115 when, err := time.Parse(time.RFC3339, "2019-03-06T15:04:05Z")

Callers

nothing calls this directly

Calls 7

MapDocumentMethod · 0.95
NewDocumentFunction · 0.92
AddFieldMappingsAtMethod · 0.80
NewIndexMappingFunction · 0.70
NewDocumentStaticMappingFunction · 0.70
NewTextFieldMappingFunction · 0.70
FatalfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…