From 577a845e1f38867fa47595b92cf601123df341bc Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 18 Aug 2021 11:40:18 +0800 Subject: [PATCH] add index for bulletin without create_indexes --- app/models/bulletin.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/bulletin.rb b/app/models/bulletin.rb index bb3eec9..b752a89 100644 --- a/app/models/bulletin.rb +++ b/app/models/bulletin.rb @@ -85,6 +85,8 @@ class Bulletin scope :filter_cats_and_tags, ->(cats,tags) {filter_by_widget_categories(cats,false).filter_by_tags(tags)} before_create :set_expire before_save :check_limit + index({postdate: 1}, { unique: false, background: true }) + index({is_top: -1,postdate: -1, _id: -1}, { unique: false, background: true }) def to_calendar_param self.to_param end