Updates notes filtering to search description too

Updates notes filtering to search for query text in both note comments and note's description.
This commit is contained in:
Nenad Vujicic 2025-01-17 18:53:05 +01:00
parent 663459d1c1
commit 4133936c63

View file

@ -263,7 +263,9 @@ module Api
end end
# Add any text filter # 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 # Add any date filter
if params[:from] if params[:from]