search_queries table
The search_queries table in the Reddit Clone Database Schema schema has 8 columns, keyed by id, with 2 foreign keys to users and subreddits.
clicked_position is the relevance feedback signal: a search with results and no click is the one worth investigating.
Columns (8)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| user_id | uuid | references users.id | |
| query | varchar(500) | not null | |
| scope | search_scope | not null | |
| subreddit_id | uuid | references subreddits.id | |
| result_count | integer | not null | |
| clicked_position | smallint | ||
| searched_at | timestamptz | not null |
Indexes (2)
(user_id, searched_at)(query)
Relationships
search_queries.user_idreferencesusers.idsearch_queries.subreddit_idreferencessubreddits.id