diff --git a/src/client/app/desktop/views/pages/search.vue b/src/client/app/desktop/views/pages/search.vue index 6ebb83cac..2576c26cb 100644 --- a/src/client/app/desktop/views/pages/search.vue +++ b/src/client/app/desktop/views/pages/search.vue @@ -6,6 +6,7 @@
+

検索機能を利用することができません。

%fa:search%「{{ q }}」に関する投稿は見つかりませんでした。

@@ -24,7 +25,8 @@ export default Vue.extend({ moreFetching: false, existMore: false, offset: 0, - empty: false + empty: false, + notAvailable: false }; }, watch: { @@ -71,7 +73,11 @@ export default Vue.extend({ res(notes); this.fetching = false; Progress.done(); - }, rej); + }, (e: string) => { + this.fetching = false; + Progress.done(); + if (e === 'searching not available') this.notAvailable = true; + }); })); }, more() { @@ -130,4 +136,18 @@ export default Vue.extend({ font-size 3em color #ccc + +.notAvailable + display block + margin 0 auto + padding 32px + max-width 400px + text-align center + color #999 + + > [data-fa] + display block + margin-bottom 16px + font-size 3em + color #ccc diff --git a/src/server/api/endpoints/notes/search.ts b/src/server/api/endpoints/notes/search.ts index badaa7afc..9124899ad 100644 --- a/src/server/api/endpoints/notes/search.ts +++ b/src/server/api/endpoints/notes/search.ts @@ -18,6 +18,8 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => const [limit = 10, limitErr] = $.num.optional.range(1, 30).get(params.limit); if (limitErr) return rej('invalid limit param'); + if (es == null) return rej('searching not available'); + es.search({ index: 'misskey', type: 'note', @@ -53,10 +55,10 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => $in: hits } }, { - sort: { - _id: -1 - } - }); + sort: { + _id: -1 + } + }); res(await Promise.all(notes.map(note => pack(note, me)))); });