class Feedcellar::Web::App
Public Instance Methods
drilled_label(resource)
click to toggle source
# File lib/feedcellar/web/app.rb, line 104 def drilled_label(resource) "#{resource.title} (#{resource.n_sub_records})" end
drilled_url(resource)
click to toggle source
# File lib/feedcellar/web/app.rb, line 100 def drilled_url(resource) url("/search?resource_id=#{resource._id}&word=#{params[:word]}") end
groonga_version()
click to toggle source
# File lib/feedcellar/web/app.rb, line 108 def groonga_version Groonga::VERSION[0..2].join(".") end
grouping(table)
click to toggle source
# File lib/feedcellar/web/app.rb, line 95 def grouping(table) key = "resource" table.group(key).sort_by {|item| item.n_sub_records }.reverse end
rroonga_version()
click to toggle source
# File lib/feedcellar/web/app.rb, line 112 def rroonga_version Groonga::BINDINGS_VERSION.join(".") end
search(words, options={})
click to toggle source
# File lib/feedcellar/web/app.rb, line 89 def search(words, options={}) database = GroongaDatabase.new database.open(Command.new.database_dir) GroongaSearcher.search(database, words, options) end
search_and_paginate()
click to toggle source
# File lib/feedcellar/web/app.rb, line 69 def search_and_paginate if params[:word] words = params[:word].split(" ") else words = [] end options ||= {} options[:resource_id] = params[:resource_id] if params[:resource_id] options[:year] = params[:year].to_i if params[:year] options[:month] = params[:month].to_i if params[:month] @feeds = search(words, options) page = (params[:page] || 1).to_i size = (params[:n_per_page] || 50).to_i @paginated_feeds = @feeds.paginate([["date", :desc]], page: page, size: size) @paginated_feeds.extend(PaginationProxy) @paginated_feeds end