Class: Uchi::Search::ResultsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/uchi/search/results_controller.rb

Overview

Companion controller for the global search page. Each searchable repository's results are loaded into their own Turbo Frame, backed by this controller, so a slow search on one repository doesn't hold up the others.

Constant Summary collapse

RESULTS_LIMIT =
5

Instance Method Summary collapse

Instance Method Details

#index ⇒ Object



14
15
16
17
18
# File 'app/controllers/uchi/search/results_controller.rb', line 14

def index
  @repository = repository
  @query = params[:query]
  @records = @query.present? ? @repository.find_all(search: @query).limit(RESULTS_LIMIT) : @repository.model.none
end