I'm not familiar with the acts_as_a_rateable plugin, but you probably
have 2 options:
* find out if the plugin stores the rating in your database somewhere
and add that column to your index
* if the rating is purely calculated in ruby, you will have to add a
model callback that caches the value in your database. I've described
this technique a few times on stack overflow, check out [1]
-- James Healy <ji...@deefa.com> Thu, 05 Aug 2010 16:37:45 +1000
[1] http://stackoverflow.com/questions/3391048/including-rails-activerecord-methods-in-sphinx-searches
My bad, that answer was untested. before_validate should be
before_validation.
Also, you're cache_rating method should look like:
def cache_rating
self.cached_rating = self.rating
end
Make sure your model has a cached_rating column in the DB.
-- James Healy <ji...@deefa.com> Fri, 06 Aug 2010 16:42:23 +1000
I think it's before_validation... and you'd probably want something more like:
before_validation :set_cached_rating
def set_cached_rating
self.cached_rating = rating
end
This way the value is actually being stored in the database :)
--
Pat
> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
>