Exemplo n.º 1
0
func init() {
	const FormatterName = "html_ex"
	registry.RegisterFragmentFormatter(FormatterName, func(config map[string]interface{}, cache *registry.Cache) (highlight.FragmentFormatter, error) {
		return NewFragmentFormatterEx("<span class=\"highlight\">", "</span>"), nil
	})

	_, err := bleve.Config.Cache.DefineFragmentFormatter(FormatterName,
		map[string]interface{}{
			"type": FormatterName,
		})
	if err != nil {
		panic(err)
	}

	_, err = bleve.Config.Cache.DefineHighlighter(FormatterName,
		map[string]interface{}{
			"type":       "simple",
			"fragmenter": "simple",
			"formatter":  FormatterName,
		})
	if err != nil {
		panic(err)
	}
}
Exemplo n.º 2
0
func init() {
	registry.RegisterFragmentFormatter(Name, Constructor)
}