As I was looking into the implementation details of the `/t/:tag_name` relevancy feed I noticed an instance variable that we do not need. Below are the results of looking for the instance_variable `@article_index` or a potential `article_index` local variable or method name. ```shell ❯ rg "@?article_index" app/controllers/stories_controller.rb 28: @article_index = true 131: @article_index = true 162: @organization_article_index = true app/controllers/stories/tagged_articles_controller.rb 18: @article_index = true app/controllers/stories/articles_search_controller.rb 7: @article_index = true app/views/articles/_single_story.html.erb 26: <% if story.cached_organization && !@organization_article_index %> 32: <a href="/<%= story.cached_user.username %>" class="crayons-avatar <% if story.cached_organization && !@organization_article_index %> crayons-avatar--s absolute -right-2 -bottom-2 border-solid border-2 border-base-inverted <% else %> crayons-avatar--l <% end %> "> 79: <% if story.cached_organization && !@organization_article_index %> ```
20 lines
551 B
Ruby
20 lines
551 B
Ruby
module Stories
|
|
class ArticlesSearchController < ApplicationController
|
|
rescue_from ArgumentError, with: :bad_request
|
|
|
|
def index
|
|
@query = I18n.t("stories_controller.searching")
|
|
|
|
@current_ordering = current_search_results_ordering
|
|
set_surrogate_key_header "articles-page-with-query"
|
|
end
|
|
|
|
private
|
|
|
|
def current_search_results_ordering
|
|
return :relevance unless params[:sort_by] == "published_at" && params[:sort_direction].present?
|
|
|
|
params[:sort_direction] == "desc" ? :newest : :oldest
|
|
end
|
|
end
|
|
end
|