Make PostQueryBuilder apply aliases earlier, immediately after parsing the search. On the post index page there are multiple places where we need to apply aliases: * When running the search with PostQueryBuilder#build. * When calculating the search count with PostQueryBuilder#fast_count. * When calculating the related tags for the sidebar. * When tracking missed searches and popular searches for Reportbooru. * When looking up wiki excerpts. Applying aliases after parsing ensures we only have to apply aliases once for all of these things. We also normalize the order of tags in searches and strip repeated tags. This is so that we have consistent cache keys for fast_count. * Fixes searches for aliased tags being counted as missed searches (fixes #4433). * Fixes wiki excerpts not showing up when searching for aliased tags.
63 lines
2.3 KiB
Plaintext
63 lines
2.3 KiB
Plaintext
<% content_for(:sidebar) do %>
|
|
<%= render "posts/partials/common/search", :path => posts_path, :tags => params[:tags], :tags_dom_id => "tags" %>
|
|
|
|
<%= render "posts/partials/index/mode_menu" %>
|
|
|
|
<%= render "posts/partials/index/blacklist" %>
|
|
|
|
<section id="tag-box">
|
|
<h1>Tags</h1>
|
|
<%= @post_set.presenter.tag_list_html(current_query: params[:tags], show_extra_links: policy(Post).show_extra_links?) %>
|
|
</section>
|
|
|
|
<%= render "posts/partials/index/options" %>
|
|
|
|
<%= render "posts/partials/index/related", post_set: @post_set %>
|
|
<% end %>
|
|
|
|
<% content_for(:content) do %>
|
|
<menu id="post-sections">
|
|
<li class="active"><a href="#" id="show-posts-link">Posts</a></li>
|
|
|
|
<% if @post_set.artist.present? %>
|
|
<li><%= link_to "Artist", artist_path(@post_set.artist), :id => "show-excerpt-link" %></li>
|
|
<% elsif @post_set.wiki_page.present? %>
|
|
<li><%= link_to "Wiki", wiki_page_path(@post_set.wiki_page), :id => "show-excerpt-link" %></li>
|
|
<% elsif @post_set.pool.present? %>
|
|
<li><%= link_to "Pool", pool_path(@post_set.pool), :id => "show-excerpt-link" %></li>
|
|
<% elsif @post_set.favgroup.present? %>
|
|
<li><%= link_to "Favorite Group", favorite_group_path(@post_set.favgroup), :id => "show-excerpt-link" %></li>
|
|
<% elsif @post_set.has_blank_wiki? %>
|
|
<li><%= link_to "Wiki", new_wiki_page_path(wiki_page: { title: @post_set.tag_string }), id: "show-excerpt-link" %></li>
|
|
<% end %>
|
|
|
|
<li id="searchbox-redirect-link" class="mobile-only"><a href="#search-box">Search »</a></li>
|
|
</menu>
|
|
|
|
<%= render "posts/partials/index/edit" %>
|
|
<%= render "posts/partials/index/excerpt", :post_set => @post_set %>
|
|
<%= render "posts/partials/index/posts", :post_set => @post_set %>
|
|
<% end %>
|
|
|
|
<div id="saved-searches-nav">
|
|
<%= render "saved_searches/interface" %>
|
|
</div>
|
|
|
|
<% if params[:tags] =~ /search:/ %>
|
|
<%= render "saved_searches/secondary_links" %>
|
|
<% else %>
|
|
<%= render "posts/partials/common/secondary_links" %>
|
|
<% end %>
|
|
|
|
<% if post_search_counts_enabled? && @post_set.query.is_simple_tag? && @post_set.current_page == 1 %>
|
|
<% if @post_set.post_count == 0 %>
|
|
<%= missed_post_search_count_js(@post_set.query.to_s) %>
|
|
<% else %>
|
|
<%= post_search_count_js(@post_set.query.to_s) %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% content_for(:html_header) do %>
|
|
<%= render "posts/partials/index/seo_meta_tags" %>
|
|
<% end %>
|