Class: Qa::Authorities::Collections

Inherits:
Base
  • Object
show all
Defined in:
app/authorities/qa/authorities/collections.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/collections.rb', line 6

def search(_q, controller)
  # The Hyrax::CollectionSearchBuilder 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