From 8011731aa0305ba4a88190780e7efca77899d968 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 23 Jun 2015 12:56:22 +1000 Subject: [PATCH] FEATURE: in:unsolved filter --- plugin.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugin.rb b/plugin.rb index e46e19d..58ca34c 100644 --- a/plugin.rb +++ b/plugin.rb @@ -201,6 +201,16 @@ after_initialize do )") end + + Search.advanced_filter(/in:unsolved/) do |posts| + posts.where("topics.id NOT IN ( + SELECT tc.topic_id + FROM topic_custom_fields tc + WHERE tc.name = 'accepted_answer_post_id' AND + tc.value IS NOT NULL + )") + + end end require_dependency 'topic_list_item_serializer'