search: support negated wildcards in post searches.
* Support negated wildcards in searches (e.g. "holding -holding_*") * Raise wildcard limit to matching 25 tags regardless of user level. * Fix wildcards potentially matching empty tags. * Fix wildcard tags being sorted by post count only, and therefore not having a stable ordering when tags have equal post counts. * Fix sidebar to calculate wildcards tags the same way the search does.
This commit is contained in:
@@ -1962,6 +1962,18 @@ class PostTest < ActiveSupport::TestCase
|
||||
assert_tag_match([post2], "a* bbb")
|
||||
end
|
||||
|
||||
should "return posts for a negated pattern" do
|
||||
post1 = create(:post, tag_string: "aaa")
|
||||
post2 = create(:post, tag_string: "aaab bbb")
|
||||
post3 = create(:post, tag_string: "bbb ccc")
|
||||
|
||||
assert_tag_match([post3], "-a*")
|
||||
assert_tag_match([post3], "bbb -a*")
|
||||
assert_tag_match([post3], "~bbb -a*")
|
||||
assert_tag_match([post1], "a* -*b")
|
||||
assert_tag_match([post2], "-*c -a*a")
|
||||
end
|
||||
|
||||
should "return posts for the id:<N> metatag" do
|
||||
posts = FactoryBot.create_list(:post, 3)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user