You could use alias_method to track queries yourself... it's not quite
so elegant, though, and you'd need to hook the current user in somehow.
It's definitely not something built into Thinking Sphinx, but I'm sure
it's possible.
I'm not sure of the best way to alias class-level methods - the
following code is for instance-level methods, but
ThinkingSphinx::Search.search is class-level, so this WILL NOT work.
It may provide some inspiration though.
module SphinxLogger
def self.included(base)
base.class_eval do
alias_method :search_without_logging, :search
def search(*args)
# Pull options out of the array
options = args.extract_options!
query = args.join(" ")
# log your query here...
# Push options back into the array
args << options
# Run the actual query in the original code
search_without_logging(*args)
end
end
end
end
ThinkingSphinx::Search.send(:include, SphinxLogger)
--
Pat
On 22/01/2009, at 11:11 PM, tyliong wrote:
>
> Hi,
>
> is it possible for TS to log the search query of every user in a
> database and update the number of times the search term was used by
> that particular user or any user?
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---