FEATURE: new search filter in:wiki
This commit is contained in:
parent
ae52f445c9
commit
5b030017d9
|
@ -2786,7 +2786,7 @@ en:
|
|||
<tr><td><code>status:open</code></td><td><code>status:closed</code></td><td><code>status:archived</code></td><td><code>status:noreplies</code></td><td><code>status:single_user</code></td></tr>
|
||||
<tr><td><code>#category-slug</code></td><td><code>category:foo</code></td><td><code>group:foo</code></td><td><code>badge:foo</code></td><td></td></tr>
|
||||
<tr><td><code>in:likes</code></td><td><code>in:posted</code></td><td><code>in:watching</code></td><td><code>in:tracking</code></td><td><code>in:private</code></td></tr>
|
||||
<tr><td><code>in:bookmarks</code></td><td><code>in:first</code></td><td><code>in:pinned</code></td><td><code>in:unpinned</code></td><td></td></tr>
|
||||
<tr><td><code>in:bookmarks</code></td><td><code>in:first</code></td><td><code>in:pinned</code></td><td><code>in:unpinned</code></td><td><code>in:wiki</code></td></tr>
|
||||
<tr><td><code>posts_count:num</code></td><td><code>before:days or date</code></td><td><code>after:days or date</code></td> <td colspan=2></td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue