Skip to content

Add support for highlight search option in struct#39

Open
Yuji-Kuroko wants to merge 4 commits intotsuwatch:masterfrom
Yuji-Kuroko:feature_highlight_search_struct
Open

Add support for highlight search option in struct#39
Yuji-Kuroko wants to merge 4 commits intotsuwatch:masterfrom
Yuji-Kuroko:feature_highlight_search_struct

Conversation

@Yuji-Kuroko
Copy link

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

@tsuwatch
Copy link
Owner

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

@tsuwatch tsuwatch self-requested a review August 19, 2019 08:11
@Yuji-Kuroko
Copy link
Author

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].

@tsuwatch
Copy link
Owner

tsuwatch commented Aug 20, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants