From 0e046faf4afb7db260ea4797e8cf32ad13d70c6c Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 18 Feb 2019 11:47:25 +0900 Subject: みつけるの人気のタグを第2ソートで連合含めたユーザー数にしたりユーザーのタグ以外は除外するように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/hashtag.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/models') diff --git a/src/models/hashtag.ts b/src/models/hashtag.ts index 742e4a254c..c1de42086e 100644 --- a/src/models/hashtag.ts +++ b/src/models/hashtag.ts @@ -5,8 +5,10 @@ const Hashtag = db.get('hashtags'); Hashtag.createIndex('tag', { unique: true }); Hashtag.createIndex('mentionedUsersCount'); Hashtag.createIndex('mentionedLocalUsersCount'); +Hashtag.createIndex('mentionedRemoteUsersCount'); Hashtag.createIndex('attachedUsersCount'); Hashtag.createIndex('attachedLocalUsersCount'); +Hashtag.createIndex('attachedRemoteUsersCount'); export default Hashtag; // 後方互換性のため @@ -29,6 +31,20 @@ Hashtag.findOne({ attachedUserIds: { $exists: false }}).then(h => { }); } }); +Hashtag.findOne({ attachedRemoteUserIds: { $exists: false }}).then(h => { + if (h != null) { + Hashtag.update({}, { + $set: { + mentionedRemoteUserIds: [], + mentionedRemoteUsersCount: 0, + attachedRemoteUserIds: [], + attachedRemoteUsersCount: 0, + } + }, { + multi: true + }); + } +}); export interface IHashtags { tag: string; @@ -36,8 +52,12 @@ export interface IHashtags { mentionedUsersCount: number; mentionedLocalUserIds: mongo.ObjectID[]; mentionedLocalUsersCount: number; + mentionedRemoteUserIds: mongo.ObjectID[]; + mentionedRemoteUsersCount: number; attachedUserIds: mongo.ObjectID[]; attachedUsersCount: number; attachedLocalUserIds: mongo.ObjectID[]; attachedLocalUsersCount: number; + attachedRemoteUserIds: mongo.ObjectID[]; + attachedRemoteUsersCount: number; } -- cgit v1.2.3-freya