Search in sources :

Example 1 with CustomHighlighter

use of org.opensearch.search.fetch.subphase.highlight.CustomHighlighter in project OpenSearch by opensearch-project.

the class SearchModuleTests method testRegisterHighlighter.

public void testRegisterHighlighter() {
    CustomHighlighter customHighlighter = new CustomHighlighter();
    SearchModule module = new SearchModule(Settings.EMPTY, 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(UnifiedHighlighter.class, highlighters.get("unified").getClass());
    assertSame(highlighters.get("custom"), customHighlighter);
}
Also used : CustomHighlighter(org.opensearch.search.fetch.subphase.highlight.CustomHighlighter) SearchPlugin(org.opensearch.plugins.SearchPlugin) UnifiedHighlighter(org.opensearch.search.fetch.subphase.highlight.UnifiedHighlighter) Highlighter(org.opensearch.search.fetch.subphase.highlight.Highlighter) FastVectorHighlighter(org.opensearch.search.fetch.subphase.highlight.FastVectorHighlighter) PlainHighlighter(org.opensearch.search.fetch.subphase.highlight.PlainHighlighter) CustomHighlighter(org.opensearch.search.fetch.subphase.highlight.CustomHighlighter)

Aggregations

SearchPlugin (org.opensearch.plugins.SearchPlugin)1 CustomHighlighter (org.opensearch.search.fetch.subphase.highlight.CustomHighlighter)1 FastVectorHighlighter (org.opensearch.search.fetch.subphase.highlight.FastVectorHighlighter)1 Highlighter (org.opensearch.search.fetch.subphase.highlight.Highlighter)1 PlainHighlighter (org.opensearch.search.fetch.subphase.highlight.PlainHighlighter)1 UnifiedHighlighter (org.opensearch.search.fetch.subphase.highlight.UnifiedHighlighter)1