Class: Qa::Authorities::FindWorks

Inherits:
Base
  • Object
show all
Defined in:
app/authorities/qa/authorities/find_works.rb

Instance Method Summary collapse

Instance Method Details

#search(_q, controller) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/authorities/qa/authorities/find_works.rb', line 6

def search(_q, controller)
  # The My::FindWorksSearchBuilder expects a current_user
  return [] unless controller.current_user
  repo = CatalogController.new.repository
  builder = search_builder(controller)
  response = repo.search(builder)
  docs = response.documents
  docs.map do |doc|
    id = doc.id
    title = doc.title
    { id: id, label: title, value: id }
  end
end