From 9a1a3d7fa6cbc53b2e66942b6f81f312b5539982 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Thu, 23 Jan 2020 21:13:59 -0500 Subject: [PATCH] Fix: improve release time claim search To improve search performance, assume we want content from the past year when viewing new and trending. Also pass rounded values to top so queries don't re-execute incorrectly. --- ui/component/claimListDiscover/view.jsx | 11 +++++++++++ ui/page/home/view.jsx | 10 +++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ui/component/claimListDiscover/view.jsx b/ui/component/claimListDiscover/view.jsx index 3a62f0097..bf3323f59 100644 --- a/ui/component/claimListDiscover/view.jsx +++ b/ui/component/claimListDiscover/view.jsx @@ -105,6 +105,17 @@ function ClaimListDiscover(props: Props) { options.release_time = `>${Math.floor( moment() .subtract(1, timeSort) + .startOf('hour') + .unix() + )}`; + } else if ( + (typeSort === TYPE_NEW || typeSort === TYPE_TRENDING) && + (options.channel_ids.length > 1 || options.any_tags.length > 1) + ) { + options.release_time = `>${Math.floor( + moment() + .subtract(1, TIME_YEAR) + .startOf('week') .unix() )}`; } diff --git a/ui/page/home/view.jsx b/ui/page/home/view.jsx index 2a0ad9468..42ed76801 100644 --- a/ui/page/home/view.jsx +++ b/ui/page/home/view.jsx @@ -51,6 +51,12 @@ function HomePage(props: Props) { link: `/$/${PAGES.CHANNELS_FOLLOWING}`, options: { orderBy: ['release_time'], + releaseTime: `>${Math.floor( + moment() + .subtract(1, 'year') + .startOf('week') + .unix() + )}`, pageSize: subscribedChannels.length > 3 ? 8 : 4, channelIds: subscribedChannels.map(subscription => { const { channelClaimId } = parseURI(subscription.uri); @@ -101,10 +107,11 @@ function HomePage(props: Props) { options: { orderBy: ['effective_amount'], pageSize: 4, - // claimType: 'stream', + claimType: 'stream', releaseTime: `>${Math.floor( moment() .subtract(1, 'week') + .startOf('day') .unix() )}`, }, @@ -129,6 +136,7 @@ function HomePage(props: Props) { timestamp: `>${Math.floor( moment() .subtract(1, 'week') + .startOf('day') .unix() )}`, },