Class: Sunspot::Search::AbstractSearch

Inherits:
Object
  • Object
show all
Defined in:
lib/sunspot_with_kaminari.rb

Instance Method Summary collapse

Instance Method Details

#any?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/sunspot_with_kaminari.rb', line 36

def any?
  total > 0
end

#current_pageObject

Returns

Integer

Current page number



12
13
14
# File 'lib/sunspot_with_kaminari.rb', line 12

def current_page
  @query.page
end

#empty?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/sunspot_with_kaminari.rb', line 32

def empty?
  total == 0
end

#limit_valueObject

Returns

Integer

Number of records displayed per page



28
29
30
# File 'lib/sunspot_with_kaminari.rb', line 28

def limit_value
  @query.per_page
end

#num_pagesObject

Returns

Integer

Total number of pages for matching documents



20
21
22
# File 'lib/sunspot_with_kaminari.rb', line 20

def num_pages
  (total.to_f / @query.per_page).ceil
end