Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for highlight search option in struct #39

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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.

None yet

2 participants