fix clustering order
This commit is contained in:
parent
030294a10d
commit
86ccb51fd0
2 changed files with 5 additions and 3 deletions
|
@ -114,7 +114,8 @@ CREATE MATERIALIZED VIEW IF NOT EXISTS global_timeline AS
|
|||
AND "userId" IS NOT NULL
|
||||
AND "userHost" IS NOT NULL
|
||||
AND "visibility" = 'public'
|
||||
PRIMARY KEY ("createdAtDate", "createdAt", "userId", "userHost", "visibility");
|
||||
PRIMARY KEY ("createdAtDate", "createdAt", "userId", "userHost", "visibility")
|
||||
WITH CLUSTERING ORDER BY ("createdAt" DESC);
|
||||
|
||||
CREATE MATERIALIZED VIEW IF NOT EXISTS local_timeline AS
|
||||
SELECT * FROM note
|
||||
|
@ -123,7 +124,8 @@ CREATE MATERIALIZED VIEW IF NOT EXISTS local_timeline AS
|
|||
AND "userId" IS NOT NULL
|
||||
AND "userHost" = 'local'
|
||||
AND "visibility" = 'public'
|
||||
PRIMARY KEY ("createdAtDate", "createdAt", "userId", "userHost", "visibility");
|
||||
PRIMARY KEY ("createdAtDate", "createdAt", "userId", "userHost", "visibility")
|
||||
WITH CLUSTERING ORDER BY ("createdAt" DESC);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS home_timeline (
|
||||
"feedUserId" ascii, -- For partitioning
|
||||
|
|
|
@ -172,7 +172,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||
execNotePaginationQuery("local", ps, filter),
|
||||
]);
|
||||
const foundNotes = [...homeFoundNotes, ...localFoundNotes]
|
||||
.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime())
|
||||
.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime()) // Descendent
|
||||
.slice(0, ps.limit * 1.5); // Some may be filtered out by Notes.packMany, thus we take more than ps.limit.
|
||||
foundPacked.push(
|
||||
...(await Notes.packMany(foundNotes, user, { scyllaNote: true })),
|
||||
|
|
Loading…
Reference in a new issue