MCPcopy
hub / github.com/zincsearch/zincsearch / NewMappingCharFilter

Function NewMappingCharFilter

pkg/uquery/analysis/char/mapping.go:29–41  ·  view source on GitHub ↗
(options interface{})

Source from the content-addressed store, hash-verified

27)
28
29func NewMappingCharFilter(options interface{}) (analysis.CharFilter, error) {
30 mappings, err := zutils.GetStringSliceFromMap(options, "mappings")
31 if err != nil || len(mappings) == 0 {
32 return nil, errors.New(errors.ErrorTypeParsingException, "[char_filter] mapping option [mappings] should be exists")
33 }
34 for _, mapping := range mappings {
35 if !strings.Contains(mapping, " => ") {
36 return nil, errors.New(errors.ErrorTypeRuntimeException, fmt.Sprintf("[char_filter] mapping option [mappings] Invalid Mapping Rule: [%s], should be [old => new]", mapping))
37 }
38 }
39
40 return zincchar.NewMappingCharFilter(mappings), nil
41}

Callers

nothing calls this directly

Calls 3

GetStringSliceFromMapFunction · 0.92
NewFunction · 0.92
ContainsMethod · 0.80

Tested by

no test coverage detected