Class: Locomotive::SearchService
- Inherits:
-
Object
- Object
- Locomotive::SearchService
- Defined in:
- app/services/locomotive/search_service.rb
Instance Method Summary collapse
Instance Method Details
#from_backoffice(site, text, options = { radius: 150 }) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/locomotive/search_service.rb', line 4 def from_backoffice(site, text, = { radius: 150 }) # scope the search by the site conditions = { 'site_id' => site._id } # locale agnostic [:locale] = false # launch the search with the current engine ::ActiveSearch.search(text, conditions, ).map do |entry| # keep only what we really need to display in the suggestions list entry.slice('label', 'locale', 'search_type').tap do |_entry| _entry['path'] = entry_path(entry) _entry['content'] = entry_content(entry) _entry['with_locale'] = site.localized? end end end |