I did some investigation into the speed of my facet searches today (they
were regularly taking > 2 seconds) and came up with the patch at [1].
This has dropped the average response time for my faceted results to
about a second. Still not great, but a massive improvement.
I'm calling facets like so:
Edition.facets("some* term*", ...)
While building the results, TS was instantiating over a thousand AR
objects over multiple requests to the database. That code path seems to
be triggered by the need for a global facets call
(ThinkingSphinx.facets) so I've shortcut the common case of single
class faceting.
To avoid the extra DB trips for single class faceting it now uses
search_for_ids to build the results instead of search.
There's no specs in the patch, in theory the behavior should be
unchanged (just faster).
cheers
-- James Healy <ji...@deefa.com> Tue, 20 Jul 2010 16:47:33 +1000
[1] http://github.com/yob/thinking-sphinx/commit/98407f2d58029fb3944d1b03a3628c57b6e544ec