From 4133936c6304b7d1a57c85d53fb7c3a906190164 Mon Sep 17 00:00:00 2001 From: Nenad Vujicic Date: Fri, 17 Jan 2025 18:53:05 +0100 Subject: [PATCH] Updates notes filtering to search description too Updates notes filtering to search for query text in both note comments and note's description. --- app/controllers/api/notes_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/notes_controller.rb b/app/controllers/api/notes_controller.rb index eca0728b6..f6d6dede9 100644 --- a/app/controllers/api/notes_controller.rb +++ b/app/controllers/api/notes_controller.rb @@ -263,7 +263,9 @@ module Api end # Add any text filter - @notes = @notes.joins(:comments).where("to_tsvector('english', note_comments.body) @@ plainto_tsquery('english', ?)", params[:q]) if params[:q] + if params[:q] + @notes = @notes.joins(:comments).where("to_tsvector('english', note_comments.body) @@ plainto_tsquery('english', ?) OR to_tsvector('english', notes.description) @@ plainto_tsquery('english', ?)", params[:q], params[:q]) + end # Add any date filter if params[:from] -- 2.39.5