Skip to content

Commit

Permalink
Updates notes filtering to search description too
Browse files Browse the repository at this point in the history
Updates notes filtering to search for query text in both note comments and note's description.
  • Loading branch information
nenad-vujicic committed Jan 17, 2025
1 parent 93008ff commit 9234913
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/api/notes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def search
end

# Add any text filter
@notes = @notes.joins(:comments).where("to_tsvector('english', note_comments.body) @@ plainto_tsquery('english', ?)", 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]) if params[:q]

# Add any date filter
if params[:from]
Expand Down

0 comments on commit 9234913

Please sign in to comment.