Skip to content

Commit d090194

Browse files
authored
Log search queries (#949)
## Summary - log search queries and result counts to metrics job ## Testing - `bundle exec rubocop` - `bin/codex_style_guard` - `bundle exec bundler-audit --update` - `bundle exec brakeman -q -w2` - `DATABASE_URL=postgres://postgres:postgres@localhost/community_engine_test bundle exec rspec spec/jobs/better_together/metrics/track_search_query_job_spec.rb` ------ https://chatgpt.com/codex/tasks/task_e_6893d6e8afdc8321885f1c9ea0fa44b0
2 parents e5ae982 + 1a2023d commit d090194

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/controllers/better_together/search_controller.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ def search # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
1818
o['text']
1919
end
2020
end.flatten
21+
22+
BetterTogether::Metrics::TrackSearchQueryJob.perform_later(
23+
@query,
24+
search_results.length,
25+
I18n.locale.to_s
26+
)
2127
end
2228

2329
# Use Kaminari for pagination

0 commit comments

Comments
 (0)