Class: QuickSearch::ArxivSearcher

Inherits:
Searcher
  • Object
show all
Defined in:
app/searchers/quick_search/arxiv_searcher.rb

Instance Method Summary collapse

Instance Method Details



34
35
36
# File 'app/searchers/quick_search/arxiv_searcher.rb', line 34

def loaded_link
  QuickSearch::Engine::ARXIV_CONFIG['loaded_link']
end

#resultsObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/searchers/quick_search/arxiv_searcher.rb', line 10

def results
  if results_list
    results_list
  else
    @results_list = []
    @response.xpath('//xmlns:entry').each do |value|
      result = OpenStruct.new

      result.title = title(value)
      result.link = link(value)
      result.author = author(value)
      result.date = published(value)
      result.journal_ref = journal(value)

      @results_list << result
    end
    @results_list
  end
end

#searchObject



4
5
6
7
8
# File 'app/searchers/quick_search/arxiv_searcher.rb', line 4

def search
  url = base_url + parameters.to_query
  raw_response = @http.get(url)
  @response = Nokogiri::XML(raw_response.body)
end

#totalObject



30
31
32
# File 'app/searchers/quick_search/arxiv_searcher.rb', line 30

def total
  @response.xpath('//opensearch:totalResults', 'opensearch' => 'http://a9.com/-/spec/opensearch/1.1/')[0].content
end