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.
This commit is contained in:
Thomas Zarebczan 2020-01-23 21:13:59 -05:00 committed by Sean Yesmunt
parent e1dd28fff6
commit 9a1a3d7fa6
2 changed files with 20 additions and 1 deletions

View file

@ -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()
)}`;
}

View file

@ -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()
)}`,
},