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

@@ -65,16 +65,6 @@ module PostSets
end
end
context "a set for the 'a b' tag query" do
setup do
@set = PostSets::Post.new("a b")
end
should "know it isn't a single tag" do
assert(!@set.is_single_tag?)
end
end
context "a set going to the 1,001st page" do
setup do
@set = PostSets::Post.new("a", 1_001)
@@ -118,10 +108,6 @@ module PostSets
@set = PostSets::Post.new("a")
end
should "know it is a single tag" do
assert(@set.is_single_tag?)
end
should "normalize its tag query" do
assert_equal("a", @set.tag_string)
end