Sha256: 441af8a8c1fbb10e38399bbe24f3548901051c0df5d88a947bb222b662efbc55

Contents?: true

Size: 819 Bytes

Versions: 2

Compression:

Stored size: 819 Bytes

Contents

class ArticleController < ApplicationController
  helper :application

  access_control do
    allow logged_in
  end

  def show
    #TODO for admins should be able to fix a page, ie reload its content if the scrapper was fixed
    @article = Article.find(params[:id])
    @article.set_user_status(current_user, ArticleStatus::STATUS_VIEWED)
  end

  #TODO pop-downs for search queries, as the user types, reasonable query extensions appear
  #TODO Slovak stemmer, I know Snowball stemmer now
  #TODO Search result highlighting
  def search
    page = (params[:page] || 1).to_i
    if params[:q]
      query = params[:q]
      search = Sunspot.search(Article) do
        keywords query
        paginate(:page => page)
        order_by(:published_at, :desc)
      end
      @articles = search.results
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solarsearch-0.0.9 app/controllers/article_controller.rb
solarsearch-0.0.6 app/controllers/article_controller.rb