From 09bb17f19ce6efd358f60916b42d2eab91255dfb Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Fri, 1 Mar 2024 23:50:27 -0500 Subject: [PATCH] limit search results to 2000 items --- sql/fix_search_posts.sql | 1 + sql/initialize.sql | 2 ++ 2 files changed, 3 insertions(+) diff --git a/sql/fix_search_posts.sql b/sql/fix_search_posts.sql index f05bb03..d778bfc 100644 --- a/sql/fix_search_posts.sql +++ b/sql/fix_search_posts.sql @@ -54,6 +54,7 @@ RETURNS SETOF catalog_grid_result AS $$ AND attachments.attachment_idx = 1 , query WHERE p.body_search_index @@ query.query + LIMIT 2000 ) SELECT 0 AS estimated_post_count, diff --git a/sql/initialize.sql b/sql/initialize.sql index 93e54d7..8fb046d 100644 --- a/sql/initialize.sql +++ b/sql/initialize.sql @@ -336,6 +336,7 @@ $$ LANGUAGE sql; -- Example: -- -- To search for posts related to 'quantum computing': -- SELECT * FROM search_posts('quantum computing'); + CREATE OR REPLACE FUNCTION search_posts(search_text text) RETURNS SETOF catalog_grid_result AS $$ WITH @@ -365,6 +366,7 @@ RETURNS SETOF catalog_grid_result AS $$ AND attachments.attachment_idx = 1 , query WHERE p.body_search_index @@ query.query + LIMIT 2000 ) SELECT 0 AS estimated_post_count,