Attempt to display some cool search stats using pg_search. About 759,000,000 results (0.29 seconds)
, Searches related to <keyword>: <keyword> <keyword> <keyword>
etc.
Hi,
Here's a gist which sketches a very basic implementation. There are some shortcomings, but I hope it's clear how to tweak and extend it to fit your purposes. I'm not sure how to get ActiveRecord to return the duration of a single query, which is why I set the
@duration
to the "realtime" benchmark of the whole time spent in ActiveRecord. You may be able to do something hacky with ActiveSupport::Notifications, but I opted for an easy-to-understand solution over a technically precise solution.P.S. the Case Commons Development Google Group is quite helpful for all things pg_search, and I'm sure they have more intelligent things to say than I!
Best, Brian