Hi Jerome This could be related to ActiveRecord/Rails' lazy loading of constants. What you could try is invoking all three models, and then have a single search, which should hopefully return everything you expect. eg:
A; B; C A.search "query" Cheers -- Pat On 26/02/2009, at 3:33 AM, Jerome Riga wrote: > After much debugging I found out what was the reason for that odd > behavior. > Everything has to do with the way the class filter was set (or not > set). > > I'll just recap on how I encountered the problem. > 1/ the model I used to search is the super class of 2 derivated > classes > class A < ActiveRecord::Base; end > class B < A; end > class C < A; end > > 2/ in rails console, search from A return results from A, B and C > in rake task, search from A return results from A only > and searchd.query.log were showing the same exact log lines. > > On the sphinx forum they told me that this is was due to the filters > of the search. I dug there and found out that when I ran the search > from a rake task the class filters of the riddle client were missing > the ones for class B and C. > > So to quick fix my problem I just made 3 searches instead of one. > > > On Wed, Feb 25, 2009 at 8:52 AM, Christian Rishøj <[email protected] > > wrote: > > > Are you sure your rake tasks runs with the same RAILS_ENV? > > Christian > > > On Feb 24, 10:17 am, Jerome Riga <[email protected]> wrote: > > any ideas or suggestions on how to tackle this problem? > > > > On Mon, Feb 23, 2009 at 1:23 PM, Jerome Riga > <[email protected]>wrote: > > > > > > > > > yes, sure > > >http://pastie.org/397367 > > > I pasted the rake task and the class definition > > > > > On Mon, Feb 23, 2009 at 1:14 PM, Pat Allan <p...@freelancing- > gods.com>wrote: > > > > >> Hi Jerome > > > > >> Can you show us exactly what your task definition is? > > > > >> -- > > >> Pat > > > > >> On 23/02/2009, at 11:58 PM, [email protected] wrote: > > > > >> > Hi all, > > > > >> > I'm trying to implement a saved search functionality that would > > >> > basically run a rake search task every day with a cronjob. > > > > >> > I got the search bit working fine in the console doing: > > >> > SavedSearch.all.each { |s| s.do_search } > > >> > with prepared data returns me what I expect. > > > > >> > However, when I run the rake task which does the same thing > and with > > >> > the same prepared data I get nothing back. > > > > >> > Does anyone has encounter similar problem? > > >> > I'm clueless about the reasons why this is happening any help > would be > > >> > greatly appreciated > > > > >> > Cheers, > > > > >> > Jerome > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
