search: move misc search parsing helpers to PostQueryBuilder.

* Move various search parser helper methods (`has_metatag?`,
  `is_single_tag?` et al) from PostSets and the Tag model to
  PostQueryBuilder.

* Fix various minor bugs stemming from trying to check if a search query
  contains certain metatags using regexes or other adhoc techniques.
This commit is contained in:
evazion
2020-04-23 01:51:30 -05:00
parent 3dab648d0e
commit dd0d9dff4a
15 changed files with 114 additions and 147 deletions

View File

@@ -19,7 +19,7 @@
<%= render "posts/partials/index/options" %>
<%= render "posts/partials/index/related" %>
<%= render "posts/partials/index/related", post_set: @post_set %>
<% end %>
<% content_for(:content) do %>

View File

@@ -15,7 +15,7 @@
<li><%= link_to "Deleted", posts_path(tags: "#{params[:tags]} status:deleted") %></li>
<li><%= link_to "Random", random_posts_path(tags: params[:tags]), id: "random-post", "data-shortcut": "r" %></li>
<% if Tag.is_simple_tag?(params[:tags]) %>
<% if post_set.query.is_simple_tag? %>
<li><%= link_to "History", post_versions_path(search: { changed_tags: params[:tags] }) %></li>
<% end %>
<li><%= link_to "Count", posts_counts_path(:tags => params[:tags]) %></li>

View File

@@ -1,4 +1,4 @@
<% if @post_set.is_empty_tag? %>
<% if @post_set.query.is_empty_search? %>
<% page_title("#{Danbooru.config.app_name}: Anime Image Board", suffix: nil) %>
<% meta_description("#{Danbooru.config.canonical_app_name} is the original anime image 'booru. Find over 3.75 million anime pictures categorized by over 100 million tags.") %>