Closed joshweir closed 6 years ago
Warnings aren't something that's been neatly mapped to TS at this point, but the way to get the data is something like the following:
results = MyModel.search "pancakes", :populate => true
# or, instead of the populate argument, do something that involves
# looking at the contents of results, thus forcing the query to Sphinx
# to take place.
warnings = nil
ThinkingSphinx::Connection.take { |connection|
# This query operates on the context of the most recent search call
warnings = connection.execute("SHOW WARNINGS").to_a
}
warnings
How to determine if the above search resulted in sphinx warnings, and collect these warnings? Calling sphinx directly I would call:
SHOW WARNINGS;
. My understanding is if the call errors, an exception will be raised:ThinkingSphinx::SphinxError
- or an exception within theThinkingSphinx
module namespace - but I couldn't find anything in the documentation about warnings.