Reputation: 561
I need highlight text between the two commas or full stops(.) If the length of the sentences is more than 100 and 500. I need whole highlighted text. Is there any way to get the highlighted sentence from the Elasticsearch.
Upvotes: 1
Views: 726
Reputation: 3887
I don't have a solution. Just a general idea. You can tokenize "." as PERIOD_START,PERIODD_END and "," as COMMA, than look use proxmity relevancy with descending order. So the farther away PERIOD_START is from PERIOD_END the better the score, and we reverse that.Not sure how to filter exact distance
And you can use highlighter to highlight PERIOD_START with pre_tag and post tag = ["","<b>]
, and PERIOD_END with pre_tag and post_tag = ["</br>","<b>"]
For example,
Hello I'm Alex END_PERIOD,START_PERIOD Joshua is a very cool dude and I think He is Okay quite END_PERIOD,START_PERIOD
Will turn into
Hello I'm Alex END_PERIOD,
(empty tag)
START_PERIOD<b>
Joshua is a very cool dude and I think He is Okay quite</b>
END_PERIOD(empty tag)
,START_PERIOD
proximity https://www.elastic.co/guide/en/elasticsearch/guide/current/proximity-relevance.html
Upvotes: 1