POC: Cross-team recent search (#20027)
Just a quick POC to move fast :P We use a search pointer to keep track of the next row to inesrt to. For every new search we increment the pointer and do modulo 5. This means that the value will always remain between 0-4. And that way, we will always overwrite the oldest entry on every search. And while getting the results, we get all results for that user. The search parameters are json marshalled and stored as a JSON blob. This is because there is no need to search/filter them in the DB. Pending items: Tests obviously. To improve: The client needs to send the channel ids instead of channel names.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
979b616189
Коммит
aa59c28b04
1
db/migrations/postgres/000084_recent_searches.down.sql
Обычный файл
1
db/migrations/postgres/000084_recent_searches.down.sql
Обычный файл
@@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS recentsearches;
|
||||
7
db/migrations/postgres/000084_recent_searches.up.sql
Обычный файл
7
db/migrations/postgres/000084_recent_searches.up.sql
Обычный файл
@@ -0,0 +1,7 @@
|
||||
CREATE TABLE IF NOT EXISTS recentsearches (
|
||||
userid CHAR(26),
|
||||
searchpointer int,
|
||||
query jsonb,
|
||||
createat bigint NOT NULL,
|
||||
PRIMARY KEY (userid, searchpointer)
|
||||
);
|
||||
Ссылка в новой задаче
Block a user