Module: Facade

Included in:
GSA
Defined in:
lib/facade.rb

Instance Method Summary collapse

Instance Method Details

#beautify_search_results(search_results) ⇒ Object



33
34
35
# File 'lib/facade.rb', line 33

def beautify_search_results(search_results)
  GSA::SearchConverter.convert(search_results)
end

#feed(args) ⇒ Object



2
3
4
5
# File 'lib/facade.rb', line 2

def feed(args)
  xml = records_to_xml(args)
  feed_to_gsa(xml, args[:datasource_name])
end

#feed_to_gsa(xml_file, datasource_name) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/facade.rb', line 17

def feed_to_gsa(xml_file, datasource_name)
  if GSA.base_uri
    GSA::Feeder.feed(xml_file, datasource_name)
  else
    raise GSA::URINotSetError, GSA::NO_URI_TEXT
  end
end

#records_to_xml(args) ⇒ Object



37
38
39
# File 'lib/facade.rb', line 37

def records_to_xml(args)
  GSA::RecordsConverter.convert(args)
end

#search(query, filters = {}) ⇒ Object



7
8
9
10
11
# File 'lib/facade.rb', line 7

def search(query, filters={})
  raw_results = search_gsa_index(query, filters)
  return raw_results if raw_results == GSA::NO_RESULTS
  beautify_search_results(raw_results)
end

#search_gsa_index(query, filters = {}) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/facade.rb', line 25

def search_gsa_index(query, filters={})
  if GSA.base_uri
    GSA::Searcher.search(query, filters)
  else
    raise GSA::URINotSetError, GSA::NO_URI_TEXT
  end
end

#uids(pretty_search_results, uid) ⇒ Object



13
14
15
# File 'lib/facade.rb', line 13

def uids(pretty_search_results, uid)
  GSA::UIDExtractor.extract(pretty_search_results, uid)
end