nazrin icon indicating copy to clipboard operation
nazrin copied to clipboard

Add support for highlight search option in struct

Open Yuji-Kuroko opened this issue 5 years ago • 3 comments

I supported highlight search option using struct pattern.

result = Movie.search.query('movie').highlight({title: {format: 'text'}}.to_json).execute
result.first.highlights.title
# => Extreme *Movie*

I didn't add anything to the README because I didn't know what to add.

TODO

  • [ ] Update README

Yuji-Kuroko avatar Aug 16 '19 05:08 Yuji-Kuroko

Highlight option already exists. https://github.com/tsuwatch/nazrin/blob/v2.7.0/lib/nazrin/search_client.rb#L94 Could you use it?

tsuwatch avatar Aug 19 '19 08:08 tsuwatch

Yes, I tried it. But the highlight option is not working.

https://github.com/tsuwatch/nazrin/pull/39/files#diff-db52a6d091a77dc5ae58d47b33a89f8cR45 When used highlight option, return hit[:highlights]. We need to mapping hit[:highlights].

Yuji-Kuroko avatar Aug 20 '19 02:08 Yuji-Kuroko

Ok, certainly not mapped. Could you implement using Result class? https://github.com/tsuwatch/nazrin/blob/master/lib/nazrin/result.rb

tsuwatch avatar Aug 20 '19 03:08 tsuwatch