(options interface{})
| 27 | ) |
| 28 | |
| 29 | func 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 | } |
nothing calls this directly
no test coverage detected