简体   繁体   English

如何突出显示elasticui搜索结果?

[英]How to highlight search results with elasticui?

I made a simple interface to display application logs using elasticui , I'd like to highlight the results to show what was matching 我做了一个简单的界面来使用elasticui显示应用程序日志,我想突出显示结果以显示匹配的内容

I tried to add this in my controller: 我试图将其添加到控制器中:

$scope.$watch('ejs', function(ejs) {
    if (ejs !== undefined) {
        ejs.Highlight(['msg']);
    };
});

but it does not work (the request payload don't include the highlight part) 但它不起作用(请求有效载荷不包括突出显示部分)

how should I proceed? 我应该如何进行?

Highlighting has not been added to ElasticUI yet, but it should be fairly trivial to add. 突出显示尚未添加到ElasticUI中,但添加起来应该很简单。 If you look at IndexController you see it sets the agg , filter , query , and sort properties of ejs.Request . 如果您看一下IndexController,就会看到它设置了ejs.Requestaggfilterquerysort属性。 What you want is also add support for the highlight property in a similar way to how ElasticUI handles the other ones. 您还需要以类似于ElasticUI处理其他属性的方式添加对highlight属性的支持。

I've also opened an issue for this. 我也为此打开了一个问题 It would be great if you could try and contribute it - otherwise I expect to look at it later on. 如果您可以尝试并贡献它,那就太好了–否则,我希望稍后再进行研究。

ElasticUI现在支持突出显示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM