diff --git a/plugin.rb b/plugin.rb index e1e118c..e46e19d 100644 --- a/plugin.rb +++ b/plugin.rb @@ -188,6 +188,21 @@ after_initialize do end end + require_dependency 'search' + + #TODO Remove when plugin is 1.0 + if Search.respond_to? :advanced_filter + Search.advanced_filter(/in:solved/) do |posts| + posts.where("topics.id 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' class ::TopicListItemSerializer