Search in sources :

Example 1 with CustomHighlighter

use of org.elasticsearch.search.fetch.subphase.highlight.CustomHighlighter in project elasticsearch by elastic.

the class SearchModuleTests method testRegisterHighlighter.

public void testRegisterHighlighter() {
    CustomHighlighter customHighlighter = new CustomHighlighter();
    SearchModule module = new SearchModule(Settings.EMPTY, false, singletonList(new SearchPlugin() {

        @Override
        public Map<String, Highlighter> getHighlighters() {
            return singletonMap("custom", customHighlighter);
        }
    }));
    Map<String, Highlighter> highlighters = module.getHighlighters();
    assertEquals(FastVectorHighlighter.class, highlighters.get("fvh").getClass());
    assertEquals(PlainHighlighter.class, highlighters.get("plain").getClass());
    assertEquals(PostingsHighlighter.class, highlighters.get("postings").getClass());
    assertSame(highlighters.get("custom"), customHighlighter);
}
Also used : CustomHighlighter(org.elasticsearch.search.fetch.subphase.highlight.CustomHighlighter) SearchPlugin(org.elasticsearch.plugins.SearchPlugin) CustomHighlighter(org.elasticsearch.search.fetch.subphase.highlight.CustomHighlighter) PlainHighlighter(org.elasticsearch.search.fetch.subphase.highlight.PlainHighlighter) FastVectorHighlighter(org.elasticsearch.search.fetch.subphase.highlight.FastVectorHighlighter) Highlighter(org.elasticsearch.search.fetch.subphase.highlight.Highlighter) PostingsHighlighter(org.elasticsearch.search.fetch.subphase.highlight.PostingsHighlighter)

Aggregations

SearchPlugin (org.elasticsearch.plugins.SearchPlugin)1 CustomHighlighter (org.elasticsearch.search.fetch.subphase.highlight.CustomHighlighter)1 FastVectorHighlighter (org.elasticsearch.search.fetch.subphase.highlight.FastVectorHighlighter)1 Highlighter (org.elasticsearch.search.fetch.subphase.highlight.Highlighter)1 PlainHighlighter (org.elasticsearch.search.fetch.subphase.highlight.PlainHighlighter)1 PostingsHighlighter (org.elasticsearch.search.fetch.subphase.highlight.PostingsHighlighter)1