meilisearch / meilisearch-rails

Meilisearch integration for Ruby on Rails
https://www.meilisearch.com
MIT License
308 stars 47 forks source link

Create a simple way to retrieve formatted objects from meilisearch in AR models #227

Closed brunoocasali closed 1 year ago

brunoocasali commented 1 year ago

This is still a draft. I'm thinking about it

When you have a search request with highlighted attributes you can just:

books = Book.search('harry', { attributes_to_highlight: ['title'] })
books.first.formatted_title

# instead of

books = Book.search('harry', { attributes_to_highlight: ['title'] })
books.first.formatted['title']
brunoocasali commented 1 year ago

Unfortunately, I don't have much time to continue working on this. If someone in the future sees this and wants to continue the work, feel free to do it!