diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index ffce1246243..f41152fcbe4 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -2786,7 +2786,7 @@ en: status:openstatus:closedstatus:archivedstatus:norepliesstatus:single_user #category-slugcategory:foogroup:foobadge:foo in:likesin:postedin:watchingin:trackingin:private - in:bookmarksin:firstin:pinnedin:unpinned + in:bookmarksin:firstin:pinnedin:unpinnedin:wiki posts_count:numbefore:days or dateafter:days or date

diff --git a/lib/search.rb b/lib/search.rb index c4bb98ca6db..22cb3f79c0c 100644 --- a/lib/search.rb +++ b/lib/search.rb @@ -231,6 +231,10 @@ class Search end end + advanced_filter(/in:wiki/) do |posts,match| + posts.where(wiki: true) + end + advanced_filter(/badge:(.*)/) do |posts,match| badge_id = Badge.where('name ilike ? OR id = ?', match, match.to_i).pluck(:id).first if badge_id diff --git a/spec/components/search_spec.rb b/spec/components/search_spec.rb index f3ee6f1561d..8d14de9411d 100644 --- a/spec/components/search_spec.rb +++ b/spec/components/search_spec.rb @@ -426,6 +426,13 @@ describe Search do expect(Search.execute('boom in:unpinned', guardian: guardian).posts.length).to eq(1) end + it 'supports wiki' do + topic = Fabricate(:topic) + wiki_post = Fabricate(:post, raw: 'this is a test 248', wiki: true, topic: topic) + + expect(Search.execute('test 248 in:wiki').posts.length).to eq(1) + end + it 'supports before and after, in:first, user:, @username' do time = Time.zone.parse('2001-05-20 2:55')