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

Function ExampleDocumentMapping_AddFieldMappingsAt

mapping/examples_test.go:48–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46}
47
48func ExampleDocumentMapping_AddFieldMappingsAt() {
49 // you can only add field mapping to those properties which already have a document mapping
50 documentMapping := NewDocumentMapping()
51 subDocumentMapping := NewDocumentMapping()
52 documentMapping.AddSubDocumentMapping("NestedProperty", subDocumentMapping)
53
54 fieldMapping := NewTextFieldMapping()
55 fieldMapping.Analyzer = "en"
56 documentMapping.AddFieldMappingsAt("NestedProperty", fieldMapping)
57
58 fmt.Println(len(documentMapping.Properties["NestedProperty"].Fields))
59 // Output:
60 // 1
61}

Callers

nothing calls this directly

Calls 4

AddSubDocumentMappingMethod · 0.95
AddFieldMappingsAtMethod · 0.95
NewDocumentMappingFunction · 0.70
NewTextFieldMappingFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…