Skip to content

Commit b51d797

Browse files
committed
検索インデックスはPublicのみに
1 parent 6f65ab3 commit b51d797

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/services/note/create.ts

+8-10
Original file line numberDiff line numberDiff line change
@@ -556,26 +556,24 @@ async function insertNote(user: IUser, data: Option, tags: string[], emojis: str
556556
}
557557

558558
function index(note: INote) {
559+
if (note.visibility !== 'public') return;
560+
559561
if (config.mecabSearch) {
560562
// for search
561563
getIndexer(note).then(mecabWords => {
562-
if (note.visibility === 'public' || note.visibility === 'home') {
563-
console.log(`Index: ${note._id} ${JSON.stringify(mecabWords)}`);
564-
}
564+
console.log(`Index: ${note._id} ${JSON.stringify(mecabWords)}`);
565565
Note.findOneAndUpdate({ _id: note._id }, {
566566
$set: { mecabWords }
567567
});
568568
});
569569

570570
// for trend
571-
if (note.visibility === 'public' || note.visibility === 'home') {
572-
getWordIndexer(note).then(trendWords => {
573-
console.log(`WordIndex: ${note._id} ${JSON.stringify(trendWords)}`);
574-
Note.findOneAndUpdate({ _id: note._id }, {
575-
$set: { trendWords }
576-
});
571+
getWordIndexer(note).then(trendWords => {
572+
console.log(`WordIndex: ${note._id} ${JSON.stringify(trendWords)}`);
573+
Note.findOneAndUpdate({ _id: note._id }, {
574+
$set: { trendWords }
577575
});
578-
}
576+
});
579577
}
580578
}
581579

0 commit comments

Comments
 (0)